mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 15:48:23 -05:00
Move app to apps/web-react in pnpm workspace layout
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { AsyncLocalStorage } from "node:async_hooks";
|
||||
|
||||
interface ViewerTimezoneContext {
|
||||
timezone: string | null;
|
||||
}
|
||||
|
||||
export const viewerTimezoneAsyncLocalStorage =
|
||||
new AsyncLocalStorage<ViewerTimezoneContext>();
|
||||
|
||||
/**
|
||||
* The viewer's IANA timezone for the current request. `null` when the browser has
|
||||
* not reported it yet, which is the case for a device's very first document request.
|
||||
*/
|
||||
export function getViewerTimezone(): string | null {
|
||||
return viewerTimezoneAsyncLocalStorage.getStore()?.timezone ?? null;
|
||||
}
|
||||
Reference in New Issue
Block a user