Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/complaindate/utils/safeTimezone.ts>safeTimezone

JavaScript date-time utilities that keep timezones on the surface
Latest
function safeTimezone
import { safeTimezone } from "https://deno.land/x/complaindate@v1.0.1/utils/safeTimezone.ts";

Get a valid timezone name, adapted for the current user.

Falls back to the timezone of the local system if no valid timezone was found in the given string.

This is useful for sanitizing the current user's timezone preference into a guaranteed valid timezone before applying any operations taking that timezone as parameter. This avoids RangeError being thrown should the timezone be invalid.

Parameters

preferredTimezone: string

Returns

string