Skip to content

Commit

Permalink
Clean up date code in shred/notifications/index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Apr 28, 2021
1 parent 7b120a4 commit 507263b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions shared/notifications/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
const notificationDates = {
1: new Date(2021, 2, 17),
2: new Date(2020, 7, 31),
3: new Date(2021, 2, 8),
};

// Messages and descriptions for these locale keys are in app/_locales/en/messages.json
export const UI_NOTIFICATIONS = {
1: {
id: 1,
date: notificationDates[1].toString(),
date: '2021-03-17',
image: {
src: 'images/mobile-link-qr.svg',
height: '270px',
Expand All @@ -17,11 +11,11 @@ export const UI_NOTIFICATIONS = {
},
2: {
id: 2,
date: notificationDates[2].toString(),
date: '2020-08-31',
},
3: {
id: 3,
date: notificationDates[3].toString(),
date: '2021-03-8',
},
};

Expand All @@ -31,21 +25,27 @@ export const getTranslatedUINoficiations = (t, locale) => {
...UI_NOTIFICATIONS[1],
title: t('notifications1Title'),
description: t('notifications1Description'),
date: new Intl.DateTimeFormat(locale).format(notificationDates[1]),
date: new Intl.DateTimeFormat(locale).format(
new Date(UI_NOTIFICATIONS[1].date),
),
},
2: {
...UI_NOTIFICATIONS[2],
title: t('notifications2Title'),
description: t('notifications2Description'),
actionText: t('notifications2ActionText'),
date: new Intl.DateTimeFormat(locale).format(notificationDates[2]),
date: new Intl.DateTimeFormat(locale).format(
new Date(UI_NOTIFICATIONS[2].date),
),
},
3: {
...UI_NOTIFICATIONS[3],
title: t('notifications3Title'),
description: t('notifications3Description'),
actionText: t('notifications3ActionText'),
date: new Intl.DateTimeFormat(locale).format(notificationDates[3]),
date: new Intl.DateTimeFormat(locale).format(
new Date(UI_NOTIFICATIONS[3].date),
),
},
};
};

0 comments on commit 507263b

Please sign in to comment.