Skip to content

Commit

Permalink
fix: update API key expiration display logic in MultiIngestionSetting…
Browse files Browse the repository at this point in the history
…s component

- display 'No Expiry' for invalid or zero date expiration dates.
  • Loading branch information
ahmadshaheer committed Dec 26, 2024
1 parent d2aa1cf commit f80c58e
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,11 @@ function MultiIngestionSettings(): JSX.Element {
APIKey.created_at,
formatTimezoneAdjustedTimestamp,
);
const formattedDateAndTime =
APIKey &&
APIKey?.expires_at &&
getFormattedTime(APIKey?.expires_at, formatTimezoneAdjustedTimestamp);

const expiresOn =
!APIKey?.expires_at || APIKey?.expires_at === '0001-01-01T00:00:00Z'
? 'No Expiry'
: getFormattedTime(APIKey?.expires_at, formatTimezoneAdjustedTimestamp);

const updatedOn = getFormattedTime(
APIKey?.updated_at,
Expand Down Expand Up @@ -987,7 +988,7 @@ function MultiIngestionSettings(): JSX.Element {
<div className="ingestion-key-last-used-at">
<CalendarClock size={14} />
Expires on <Minus size={12} />
<Typography.Text>{formattedDateAndTime}</Typography.Text>
<Typography.Text>{expiresOn}</Typography.Text>
</div>
</div>
</div>
Expand Down

0 comments on commit f80c58e

Please sign in to comment.