Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/formatting.js
import { currency } from '@components/Common/Ticker.js'; | import { currency } from 'components/Common/Ticker.js'; | ||||
export const formatDate = (dateString, userLocale = 'en') => { | export const formatDate = (dateString, userLocale = 'en') => { | ||||
const options = { month: 'short', day: 'numeric', year: 'numeric' }; | const options = { month: 'short', day: 'numeric', year: 'numeric' }; | ||||
const dateFormattingError = 'Unable to format date.'; | const dateFormattingError = 'Unable to format date.'; | ||||
try { | try { | ||||
if (dateString) { | if (dateString) { | ||||
return new Date(dateString * 1000).toLocaleDateString( | return new Date(dateString * 1000).toLocaleDateString( | ||||
userLocale, | userLocale, | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |