diff options
author | Desmond Kyeremeh <elDekyfin@gmail.com> | 2021-07-11 23:39:30 +0000 |
---|---|---|
committer | Desmond Kyeremeh <elDekyfin@gmail.com> | 2021-07-11 23:39:30 +0000 |
commit | 004367fc1fd389b169821eb2d73266490f409999 (patch) | |
tree | 1b7e6f13c03326a957bdb78351853f429156b3ae /modern/src/common/formatter.js | |
parent | 1b93de84e2bf6a6532bdb03e1ae75e47061a4dca (diff) | |
parent | 702e674ecce7de1a4f4318ef8f30c572264a4560 (diff) | |
download | trackermap-web-004367fc1fd389b169821eb2d73266490f409999.tar.gz trackermap-web-004367fc1fd389b169821eb2d73266490f409999.tar.bz2 trackermap-web-004367fc1fd389b169821eb2d73266490f409999.zip |
Merge remote-tracking branch 'upstream/master' into group-config
Diffstat (limited to 'modern/src/common/formatter.js')
-rw-r--r-- | modern/src/common/formatter.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js index 7441d01e..3c0341b7 100644 --- a/modern/src/common/formatter.js +++ b/modern/src/common/formatter.js @@ -1,6 +1,12 @@ import moment from 'moment'; import t from './localization'; +export const formatBoolean = (value) => (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 formatPosition = (value, key) => { if (value != null && typeof value === 'object') { value = value[key]; @@ -29,12 +35,6 @@ export const formatPosition = (value, key) => { } }; -export const formatBoolean = (value) => (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 formatDistance = (value, unit) => { switch (unit) { case 'mi': |