mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Merge branch 'master' into dev
Some checks failed
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled
Some checks failed
Node.js CI / build (postgresql, 18.18, 10) (push) Has been cancelled
# Conflicts: # .github/workflows/cd.yml # package.json # pnpm-lock.yaml # src/lib/date.ts # src/lib/schema.ts
This commit is contained in:
commit
d23ad5f272
4 changed files with 40 additions and 32 deletions
|
|
@ -103,9 +103,18 @@ export const DATE_FORMATS = {
|
|||
year: 'yyyy',
|
||||
};
|
||||
|
||||
const TIMEZONE_MAPPINGS: Record<string, string> = {
|
||||
'Asia/Calcutta': 'Asia/Kolkata',
|
||||
};
|
||||
|
||||
export function normalizeTimezone(timezone: string): string {
|
||||
return TIMEZONE_MAPPINGS[timezone] || timezone;
|
||||
}
|
||||
|
||||
export function isValidTimezone(timezone: string) {
|
||||
try {
|
||||
Intl.DateTimeFormat(undefined, { timeZone: timezone });
|
||||
const normalizedTimezone = normalizeTimezone(timezone);
|
||||
Intl.DateTimeFormat(undefined, { timeZone: normalizedTimezone });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue