Merge branch 'master' into dev
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:
Mike Cao 2025-10-04 13:38:58 -07:00
commit d23ad5f272
4 changed files with 40 additions and 32 deletions

View file

@ -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;