use NumberFormat

This commit is contained in:
Henry Jameson 2025-04-10 18:26:09 +03:00
commit f112724a5a

View file

@ -107,16 +107,15 @@ const FilteringTab = {
...mapActions(useServerSideStorageStore, ['setPreference', 'unsetPreference', 'pushServerSideStorage']), ...mapActions(useServerSideStorageStore, ['setPreference', 'unsetPreference', 'pushServerSideStorage']),
getDatetimeLocal (timestamp) { getDatetimeLocal (timestamp) {
const date = new Date(timestamp) const date = new Date(timestamp)
let fmt = new Intl.NumberFormat("en-US", {minimumIntegerDigits: 2})
const datetime = [ const datetime = [
date.getFullYear(), date.getFullYear(),
'-', '-',
date.getMonth() < 9 ? ('0' + (date.getMonth() + 1)) : (date.getMonth() + 1), fmt.format(date.getMonth()),
'-',
date.getDate() < 10 ? ('0' + date.getDate()) : date.getDate(),
'T', 'T',
date.getHours() < 10 ? ('0' + date.getHours()) : date.getHours(), fmt.format(date.getHours()),
':', ':',
date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes(), fmt.format(date.getMinutes())
].join('') ].join('')
return datetime return datetime
}, },