Skip to content

Commit

Permalink
fix: make the lastUpdatedDate consistent on AnalyticsV2
Browse files Browse the repository at this point in the history
  • Loading branch information
jajjibhai008 committed Jan 21, 2025
1 parent fdb32f2 commit b6b6f5b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/AdvanceAnalyticsV2/AnalyticsV2Page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Skills from './tabs/Skills';
import { useEnterpriseAnalyticsAggregatesData } from './data/hooks';
import { GRANULARITY, CALCULATION, ANALYTICS_WARNING_BANNER_COOKIE } from './data/constants';
import WarningBanner from './WarningBanner';
import { formatTimestamp } from '../../utils';

const PAGE_TITLE = 'Analytics';

Expand All @@ -35,10 +36,7 @@ const AnalyticsV2Page = ({ enterpriseId }) => {
});
const showWarningBanner = cookies.get(ANALYTICS_WARNING_BANNER_COOKIE);
const currentDate = new Date().toISOString().split('T')[0];
const formatDate = (dateString) => {
const options = { year: 'numeric', month: 'long', day: 'numeric' };
return new Date(dateString).toLocaleDateString(undefined, options);
};
const defaultDataUpdatedDate = new Date().toISOString();
return (
<>
<Helmet title={PAGE_TITLE} />
Expand All @@ -52,7 +50,7 @@ const AnalyticsV2Page = ({ enterpriseId }) => {
id="advance.analytics.data.refresh.msg"
defaultMessage="Data updated on {date}"
description="Data refresh message"
values={{ date: formatDate(data?.lastUpdatedAt || currentDate) }}
values={{ date: formatTimestamp({ timestamp: data?.lastUpdatedAt || defaultDataUpdatedDate }) }}
/>
</span>
</div>
Expand Down

0 comments on commit b6b6f5b

Please sign in to comment.