feat: store user timezone (#7902)

* feat: store user timezone

* tz validation
This commit is contained in:
Hemachandar
2024-11-07 07:36:19 +05:30
committed by GitHub
parent 356b0916fd
commit 62ee075a6f
10 changed files with 66 additions and 2 deletions
+13
View File
@@ -15,3 +15,16 @@ export const zodIconType = () =>
z.string().regex(emojiRegex()),
zodEnumFromObjectKeys(IconLibrary.mapping),
]);
export const zodTimezone = () =>
z.string().refine(
(timezone) => {
try {
Intl.DateTimeFormat(undefined, { timeZone: timezone });
return true;
} catch {
return false;
}
},
{ message: "invalid timezone" }
);