Skip to content

Commit

Permalink
- client: Fix beyond 24 hour time format for en locale
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemBaskal committed Jun 4, 2020
1 parent 539ccb2 commit 459e3cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/src/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 459e3cf

Please sign in to comment.