1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-05 04:15:31 +01:00

fix: fixes 24 hour style being broken on chrome. fixes #2680 (#2685)

This commit is contained in:
Amir Raminfar
2024-01-10 11:10:10 -08:00
committed by GitHub
parent 9cb973f30e
commit cc6ae1d63c

View File

@@ -14,14 +14,23 @@ const dateOverride = computed(() => (dateLocale.value === "auto" ? undefined : d
const dateFormatter = computed(
() => new Intl.DateTimeFormat(dateOverride.value, { day: "2-digit", month: "2-digit", year: "numeric" }),
);
const use12Hour = computed(() => ({ auto: undefined, "12": true, "24": false })[hourStyle.value]);
const hourCycle = computed(() => {
switch (hourStyle.value) {
case "auto":
return undefined;
case "12":
return "h12";
case "24":
return "h23";
}
});
const timeFormatter = computed(
() =>
new Intl.DateTimeFormat(undefined, {
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: use12Hour.value,
hourCycle: hourCycle.value,
}),
);