mirror of
https://github.com/outline/outline.git
synced 2026-05-08 02:50:30 -05:00
feat: store user timezone (#7902)
* feat: store user timezone * tz validation
This commit is contained in:
@@ -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" }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user