Merge branch 'master' into dev
# Conflicts: # .github/workflows/cd.yml # package.json # pnpm-lock.yaml # src/lib/date.ts # src/lib/schema.ts
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user