Skip to content

Commit

Permalink
fix: revert updated_at formatting (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy authored Jun 13, 2024
1 parent f360e16 commit aabc76b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
10 changes: 0 additions & 10 deletions src/utils/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,16 +464,6 @@ describe('utils/helpers.ts', () => {
});

describe('formatNotificationUpdatedAt', () => {
it('should use last_read_at if available', () => {
const notification = {
...mockSingleNotification,
last_read_at: '2021-06-23T16:00:00Z',
updated_at: '2021-06-23T17:00:00Z',
};

expect(formatNotificationUpdatedAt(notification)).toContain('ago');
});

it('should use updated_at if last_read_at is null', () => {
const notification = {
...mockSingleNotification,
Expand Down
4 changes: 1 addition & 3 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,8 @@ export function formatForDisplay(text: string[]): string {
export function formatNotificationUpdatedAt(
notification: Notification,
): string {
const date = notification.last_read_at ?? notification.updated_at;

try {
return formatDistanceToNowStrict(parseISO(date), {
return formatDistanceToNowStrict(parseISO(notification.updated_at), {
addSuffix: true,
});
} catch (e) {}
Expand Down

0 comments on commit aabc76b

Please sign in to comment.