Sha256: bf3b54d7da3bc07f598bc1144584f9dbf940b5844b9eb3506d41637e832741dc
Contents?: true
Size: 466 Bytes
Versions: 7
Compression:
Stored size: 466 Bytes
Contents
import { DateTime } from 'luxon'; import numeral from 'numeral'; export const numberToCurrency = amount => { const format = '$0,0.00'; const floatAmount = parseFloat(amount); if (floatAmount < 0) { return `(${numeral(Math.abs(floatAmount)).format(format)})`; } return numeral(floatAmount).format(format); }; export const formatTime = time => { if (!time) return 'N/A'; return DateTime.fromISO(time).toLocaleString(DateTime.DATETIME_SHORT); };
Version data entries
7 entries across 7 versions & 1 rubygems