You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gristlabs_grist-core/app/client/lib/guessTimezone.ts

12 lines
422 B

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();
}