24h option

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

View file

@ -30,6 +30,11 @@ const GeneralTab = {
value: mode, value: mode,
label: this.$t(`settings.conversation_display_${mode}`) label: this.$t(`settings.conversation_display_${mode}`)
})), })),
absoluteTime12hOptions: ['24h', '12h'].map(mode => ({
key: mode,
value: mode,
label: this.$t(`settings.absolute_time_format_12h_${mode}`)
})),
conversationOtherRepliesButtonOptions: ['below', 'inside'].map(mode => ({ conversationOtherRepliesButtonOptions: ['below', 'inside'].map(mode => ({
key: mode, key: mode,
value: mode, value: mode,

View file

@ -249,6 +249,16 @@
{{ $t('settings.absolute_time_format_min_age') }} {{ $t('settings.absolute_time_format_min_age') }}
</UnitSetting> </UnitSetting>
</li> </li>
<li>
<ChoiceSetting
id="absoluteTime12h"
path="absoluteTime12h"
:options="absoluteTime12hOptions"
:expert="1"
>
{{ $t('settings.absolute_time_format_12h') }}
</ChoiceSetting>
</li>
</ul> </ul>
<h3>{{ $t('settings.attachments') }}</h3> <h3>{{ $t('settings.attachments') }}</h3>
<li> <li>

View file

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

View file

@ -532,6 +532,9 @@
"emoji_reactions_scale": "Reactions scale factor", "emoji_reactions_scale": "Reactions scale factor",
"absolute_time_format": "Use absolute time format", "absolute_time_format": "Use absolute time format",
"absolute_time_format_min_age": "Only use for time older than this amount of time", "absolute_time_format_min_age": "Only use for time older than this amount of time",
"absolute_time_format_12h": "Time format",
"absolute_time_format_12h_12h": "12 hour format (i.e. 10:00 PM)",
"absolute_time_format_12h_24h": "24 hour format (i.e. 22:00)",
"export_theme": "Save preset", "export_theme": "Save preset",
"filtering": "Filtering", "filtering": "Filtering",
"wordfilter": "Wordfilter", "wordfilter": "Wordfilter",

View file

@ -193,6 +193,7 @@ export const defaultState = {
autoSaveDraft: undefined, // instance default autoSaveDraft: undefined, // instance default
useAbsoluteTimeFormat: undefined, // instance default useAbsoluteTimeFormat: undefined, // instance default
absoluteTimeFormatMinAge: undefined, // instance default absoluteTimeFormatMinAge: undefined, // instance default
absoluteTime12h: undefined, // instance default
imageCompression: true imageCompression: true
} }

View file

@ -131,6 +131,7 @@ const defaultState = {
autoSaveDraft: false, autoSaveDraft: false,
useAbsoluteTimeFormat: false, useAbsoluteTimeFormat: false,
absoluteTimeFormatMinAge: '0d', absoluteTimeFormatMinAge: '0d',
absoluteTime12h: '24h',
// Nasty stuff // Nasty stuff
customEmoji: [], customEmoji: [],