From 459e3cf8e185033d7e20f0b1d24c6e0146310017 Mon Sep 17 00:00:00 2001 From: ArtemBaskal Date: Thu, 4 Jun 2020 20:45:17 +0300 Subject: [PATCH] - client: Fix beyond 24 hour time format for en locale --- client/src/helpers/helpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index a6bd84955ec..bb0dbe55511 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -43,8 +43,10 @@ export const formatTime = (time) => { * @returns string Returns the date and time in the format DD/MM/YYYY, HH:mm */ export const formatDateTime = (dateTime, options = DEFAULT_DATE_FORMAT_OPTIONS) => { - const currentLanguage = i18n.languages[0] || DEFAULT_LANGUAGE; - const parsedTime = dateParse(dateTime); + const { language } = navigator; + const currentLanguage = (language.slice(0, 2) === 'en' || !language) ? 'en-GB' : language; + + const parsedTime = new Date(dateTime); return parsedTime.toLocaleString(currentLanguage, options); };