mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
test: fix e2e
This commit is contained in:
parent
537e7f97b5
commit
a8e3c46d3d
1 changed files with 8 additions and 5 deletions
|
|
@ -47,16 +47,19 @@ const getTimeVal = (d: Date): string => {
|
|||
const v = new Date(d).toLocaleTimeString('en-GB', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: isBrowserLocaleClockType24h(),
|
||||
hour12: isBrowserLocaleClockType12h(),
|
||||
timeZone: tz,
|
||||
});
|
||||
console.log(
|
||||
`Enter time input value ${v} – ${tz}; 12h: ${isBrowserLocaleClockType24h()}`,
|
||||
`Enter time input value ${v} – ${tz}; 12h: ${isBrowserLocaleClockType12h()}`,
|
||||
);
|
||||
return v;
|
||||
};
|
||||
|
||||
const isBrowserLocaleClockType24h = (): boolean => {
|
||||
const hr = new Intl.DateTimeFormat([], { hour: 'numeric' }).format();
|
||||
return Number.isInteger(Number(hr));
|
||||
const isBrowserLocaleClockType12h = (): boolean => {
|
||||
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
|
||||
const parts = new Intl.DateTimeFormat(locale, { hour: 'numeric' }).formatToParts(
|
||||
new Date(),
|
||||
);
|
||||
return parts.some((part) => part.type === 'dayPeriod');
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue