diff options
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': |