* (ui): fix date format

This commit is contained in:
Andrey Meshkov 2020-10-05 11:21:43 +03:00
parent a7d2dd7bdb
commit 8856dd6e4c

View file

@ -47,12 +47,8 @@ export const formatTime = (time, options = DEFAULT_TIME_FORMAT) => {
* @returns {string} Returns the date and time in the specified format * @returns {string} Returns the date and time in the specified format
*/ */
export const formatDateTime = (dateTime, options = DEFAULT_DATE_FORMAT_OPTIONS) => { export const formatDateTime = (dateTime, options = DEFAULT_DATE_FORMAT_OPTIONS) => {
const { language } = navigator;
const currentLanguage = (language.slice(0, 2) === 'en' || !language) ? 'en-GB' : language;
const parsedTime = new Date(dateTime); const parsedTime = new Date(dateTime);
return parsedTime.toLocaleString(navigator.language, options);
return parsedTime.toLocaleString(currentLanguage, options);
}; };
/** /**