aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/formatter.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index db0b7ff..f8a55da 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -4,9 +4,12 @@ export const formatBoolean = (value, t) => (value ? t('sharedYes') : t('sharedNo
export const formatNumber = (value, precision = 1) => Number(value.toFixed(precision));
-export const formatDate = (value, format = 'YYYY-MM-DD HH:mm') => moment(value).format(format);
+export const formatDate = (value, locale) => new Intl.DateTimeFormat(locale, {
+ dateStyle: 'medium',
+ timeStyle: 'short',
+}).format(Date.parse(value));
-export const formatPosition = (value, key, t) => {
+export const formatPosition = (value, key, t, locale = 'es') => {
if (value != null && typeof value === 'object') {
value = value[key];
}
@@ -15,7 +18,7 @@ export const formatPosition = (value, key, t) => {
case 'deviceTime':
case 'serverTime':
case 'eventTime':
- return moment(value).format('LLL');
+ return formatDate(value, locale);
case 'latitude':
case 'longitude':
return value.toFixed(5);