fix(api-key): make the expires in human readable in api keys (#7864)

* fix(api-key): human readable expires in

* fix(api-key): human readable expires in
This commit is contained in:
Vikrant Gupta 2025-05-08 13:44:02 +05:30 committed by GitHub
parent 503e4cdf00
commit 08d9a74055
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,7 @@ import axios, { AxiosError } from 'axios';
import cx from 'classnames'; import cx from 'classnames';
import { SOMETHING_WENT_WRONG } from 'constants/api'; import { SOMETHING_WENT_WRONG } from 'constants/api';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { useGetAllAPIKeys } from 'hooks/APIKeys/useGetAllAPIKeys'; import { useGetAllAPIKeys } from 'hooks/APIKeys/useGetAllAPIKeys';
import { useNotifications } from 'hooks/useNotifications'; import { useNotifications } from 'hooks/useNotifications';
import { import {
@ -52,6 +53,8 @@ import { useCopyToClipboard } from 'react-use';
import { APIKeyProps } from 'types/api/pat/types'; import { APIKeyProps } from 'types/api/pat/types';
import { USER_ROLES } from 'types/roles'; import { USER_ROLES } from 'types/roles';
dayjs.extend(relativeTime);
export const showErrorNotification = ( export const showErrorNotification = (
notifications: NotificationInstance, notifications: NotificationInstance,
err: Error, err: Error,
@ -495,7 +498,7 @@ function APIKeys(): JSX.Element {
expiresIn <= 3 ? 'danger' : 'warning', expiresIn <= 3 ? 'danger' : 'warning',
)} )}
> >
<span className="dot" /> Expires in {expiresIn} Days <span className="dot" /> Expires {dayjs().to(expiresOn)}
</div> </div>
)} )}