diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-11 16:38:03 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-11 16:38:03 -0600 |
commit | 8038f22dc100d09ff53808d4d372567a262c24ff (patch) | |
tree | cc48f422b0a6b0c226f0e5798b0e9a27cbeb9aed /modern/src/common/formatter.js | |
parent | e490ffb046eff933a134f96323c8e6c765175cf0 (diff) | |
download | etbsa-traccar-web-8038f22dc100d09ff53808d4d372567a262c24ff.tar.gz etbsa-traccar-web-8038f22dc100d09ff53808d4d372567a262c24ff.tar.bz2 etbsa-traccar-web-8038f22dc100d09ff53808d4d372567a262c24ff.zip |
A lot of changes!
Diffstat (limited to 'modern/src/common/formatter.js')
-rw-r--r-- | modern/src/common/formatter.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js index 0ff4e74..22d1654 100644 --- a/modern/src/common/formatter.js +++ b/modern/src/common/formatter.js @@ -49,12 +49,12 @@ export const formatDistance = (value, unit, t) => { export const formatSpeed = (value, unit, t) => { switch (unit) { case 'kmh': - return `${(value * 1.852).toFixed(2)} ${t('sharedKmh')}`; + return `${(value * 1.852).toFixed(0)} ${t('sharedKmh')}`; case 'mph': - return `${(value * 1.15078).toFixed(2)} ${t('sharedMph')}`; + return `${(value * 1.15078).toFixed(0)} ${t('sharedMph')}`; case 'kn': default: - return `${(value * 1).toFixed(2)} ${t('sharedKn')}`; + return `${(value * 1).toFixed(0)} ${t('sharedKn')}`; } }; @@ -70,7 +70,10 @@ export const formatVolume = (value, unit, t) => { } }; -export const formatHours = (value) => moment.duration(value).humanize(); +export const formatHours = (value, t) => { + moment.locale('es'); + return `${moment.duration(value).asHours().toFixed(0)} ${t('sharedHours')}`; +} export const formatCoordinate = (key, value, unit) => { let hemisphere; |