From 9204ed30ce783d82f54c60384f38fec1ecc2625a Mon Sep 17 00:00:00 2001 From: Jaiwanth Date: Wed, 9 Jun 2021 16:40:52 +0530 Subject: [PATCH] Switch to localeDateString for i18n --- src/DateUtils.ts | 10 +++------- src/i18n/strings/en_EN.json | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/DateUtils.ts b/src/DateUtils.ts index 1eaa331f52..758971e58d 100644 --- a/src/DateUtils.ts +++ b/src/DateUtils.ts @@ -138,13 +138,9 @@ export function wantsDateSeparator(prevEventDate: Date, nextEventDate: Date): bo } export function formatFullDateNoDay(date: Date) { - return _t("%(year)s-%(month)s-%(day)s at %(hours)s.%(minutes)s.%(seconds)s", { - year: date.getFullYear(), - month: pad(date.getMonth() + 1), - day: pad(date.getDate()), - hours: pad(date.getHours()), - minutes: pad(date.getMinutes()), - seconds: pad(date.getSeconds()), + return _t("%(date)s at %(time)s", { + date: date.toLocaleDateString().replace(/\//g, '-'), + time: date.toLocaleTimeString().replace(/:/g, '-'), }); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index c52ee00ae7..fc0b3c6c06 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -105,7 +105,7 @@ "%(weekDayName)s, %(monthName)s %(day)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(time)s", "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s", "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s", - "%(year)s-%(month)s-%(day)s at %(hours)s.%(minutes)s.%(seconds)s": "%(year)s-%(month)s-%(day)s at %(hours)s.%(minutes)s.%(seconds)s", + "%(date)s at %(time)s": "%(date)s at %(time)s", "Who would you like to add to this community?": "Who would you like to add to this community?", "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID": "Warning: any person you add to a community will be publicly visible to anyone who knows the community ID", "Invite new community members": "Invite new community members",