UNPKG

@barchart/common-js

Version:
75 lines (74 loc) 2.17 kB
/** * An enumeration item that lists timezones, according to the common names * used in the tz database (see https://en.wikipedia.org/wiki/Tz_database). * The full list of names is sourced from moment.js; however, this wikipedia * article lists them: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones * * @public * @extends {Enum} */ export default class Timezones extends Enum { /** * Given a code, returns the corresponding enumeration item. * * @public * @static * @param {string} code * @returns {Timezones|null} */ public static parse(code: string): Timezones | null; /** * UTC. * * @public * @static * @returns {Timezones} */ public static get UTC(): Timezones; /** * America/Chicago. * * @public * @static * @returns {Timezones} */ public static get AMERICA_CHICAGO(): Timezones; /** * America/New_York. * * @public * @static * @returns {Timezones} */ public static get AMERICA_NEW_YORK(): Timezones; /** * America/Denver. * * @public * @static * @returns {Timezones} */ public static get AMERICA_DENVER(): Timezones; /** * @param {string} code - The timezone name. */ constructor(code: string); /** * Attempts to determine whether daylight saving time is in effect. * * @public * @param {number=} timestamp - The moment at which daylight saving time is checked; otherwise, the current time is used. * @returns {boolean} */ public getIsDaylightSavingsTime(timestamp?: number | undefined): boolean; /** * Calculates and returns the offset of a timezone from UTC. * * @public * @param {number=} timestamp - The moment at which the offset is calculated; otherwise, the current time is used. * @param {boolean=} milliseconds - Whether the offset should be returned in milliseconds instead of minutes. * @returns {number} */ public getUtcOffset(timestamp?: number | undefined, milliseconds?: boolean | undefined): number; } import Enum from './Enum.js';