24h option

This commit is contained in:
Henry Jameson 2025-01-27 12:00:28 +02:00
commit 92c82a0a34
6 changed files with 31 additions and 4 deletions

View file

@ -28,6 +28,9 @@ export default {
}
return DateUtils.durationStrToMs(this.$store.getters.mergedConfig.absoluteTimeFormatMinAge) <= this.relativeTimeMs
},
time12hFormat () {
return this.$store.getters.mergedConfig.absoluteTimeFormat12h === '12h'
},
browserLocale () {
return localeService.internalToBrowserLocale(this.$i18n.locale)
},
@ -57,22 +60,26 @@ export default {
if (DateUtils.isSameDay(this.timeAsDate, now)) {
return new Intl.DateTimeFormat(this.browserLocale, {
minute: 'numeric',
hour: 'numeric'
hour: 'numeric',
hour12: this.time12hFormat
})
} else if (DateUtils.isSameMonth(this.timeAsDate, now)) {
return new Intl.DateTimeFormat(this.browserLocale, {
month: 'short',
day: 'numeric'
day: 'numeric',
hour12: this.time12hFormat
})
} else if (DateUtils.isSameYear(this.timeAsDate, now)) {
return new Intl.DateTimeFormat(this.browserLocale, {
month: 'short',
day: 'numeric'
day: 'numeric',
hour12: this.time12hFormat
})
} else {
return new Intl.DateTimeFormat(this.browserLocale, {
year: 'numeric',
month: 'short'
month: 'short',
hour12: this.time12hFormat
})
}
})()