From 00abadd429774f575b180ae963260c97024eace0 Mon Sep 17 00:00:00 2001 From: Shaheer Kochai Date: Thu, 26 Dec 2024 18:10:53 +0430 Subject: [PATCH] fix: update API key expiration display logic in MultiIngestionSettings component (#6717) - display 'No Expiry' for invalid or zero date expiration dates. --- .../IngestionSettings/MultiIngestionSettings.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx b/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx index 53fd5269d6..6c817a41da 100644 --- a/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx +++ b/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx @@ -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, @@ -987,7 +988,7 @@ function MultiIngestionSettings(): JSX.Element {
Expires on - {formattedDateAndTime} + {expiresOn}