feat(app/utils, plugins): normalize dates with improved format (#573)

This commit is contained in:
Simon Lecoq
2021-10-13 22:08:31 -04:00
committed by GitHub
parent 19036b2e41
commit 662fe8de2f
16 changed files with 32 additions and 16 deletions

View File

@@ -1131,6 +1131,14 @@
return `${text.substring(0, length)}`
}
data.f.date = function(string, options) {
if (options.date) {
delete options.date
Object.assign(options, {day:"numeric", month:"short", year:"numeric"})
}
if (options.time) {
delete options.time
Object.assign(options, {hour:"2-digit", minute:"2-digit", second:"2-digit"})
}
return new Intl.DateTimeFormat("en-GB", options).format(new Date(string))
}
data.f.license = function(text) {