Skip to content

Commit aabc76b

Browse files
authored
fix: revert updated_at formatting (#1230)
1 parent f360e16 commit aabc76b

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

src/utils/helpers.test.ts

-10
Original file line numberDiff line numberDiff line change
@@ -464,16 +464,6 @@ describe('utils/helpers.ts', () => {
464464
});
465465

466466
describe('formatNotificationUpdatedAt', () => {
467-
it('should use last_read_at if available', () => {
468-
const notification = {
469-
...mockSingleNotification,
470-
last_read_at: '2021-06-23T16:00:00Z',
471-
updated_at: '2021-06-23T17:00:00Z',
472-
};
473-
474-
expect(formatNotificationUpdatedAt(notification)).toContain('ago');
475-
});
476-
477467
it('should use updated_at if last_read_at is null', () => {
478468
const notification = {
479469
...mockSingleNotification,

src/utils/helpers.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,8 @@ export function formatForDisplay(text: string[]): string {
157157
export function formatNotificationUpdatedAt(
158158
notification: Notification,
159159
): string {
160-
const date = notification.last_read_at ?? notification.updated_at;
161-
162160
try {
163-
return formatDistanceToNowStrict(parseISO(date), {
161+
return formatDistanceToNowStrict(parseISO(notification.updated_at), {
164162
addSuffix: true,
165163
});
166164
} catch (e) {}

0 commit comments

Comments
 (0)