mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
12 lines
422 B
TypeScript
12 lines
422 B
TypeScript
|
import {loadMomentTimezone} from 'app/client/lib/imports';
|
||
|
|
||
|
/**
|
||
|
* Returns the browser timezone, using moment.tz.guess(), allowing overriding it via a "timezone"
|
||
|
* URL parameter, for the sake of tests.
|
||
|
*/
|
||
|
export async function guessTimezone() {
|
||
|
const moment = await loadMomentTimezone();
|
||
|
const searchParams = new URLSearchParams(window.location.search);
|
||
|
return searchParams.get('timezone') || moment.tz.guess();
|
||
|
}
|