import { RawData } from './types'; export { RawData } from './types'; /** * Represents abbreviation, daylight savings and timezone offset for * a single time zone. * * @public */ export interface ZoneInfo { /** * Time zone identifier. */ zoneid: string; /** * Time zone 3-character abbreviation. */ abbr: string; /** * Flag indicating the zone is currently in daylight savings time. */ dst: number; /** * Time zone offset from UTC. */ offset: number; } /** * Represents metadata associated with a timezone. * * @public */ export interface ZoneMeta { /** * Time zone identifier. Corrected if the metadata was looked up using an alias. */ zoneid: string; /** * Current standard offset from UTC, in milliseconds. */ stdoffset: number; /** * Latitude of the zone's "principal location". */ latitude: number; /** * Longitude of the zone's "principal location". */ longitude: number; /** * ISO 3166 2-character country code for all countries which * overlap the timezone. */ countries: string[]; } /** * Interface to accessing time zone data. * * @public */ export interface Tz { /** * Get the info for a time zone using a UTC timestamp. */ fromUTC(zoneid: string, utc: number): ZoneInfo | undefined; /** * Get the info for a time zone using a Wall Clock timestamp. This returns * the corresponding UTC timestamp and the timezone info record, or undefined * if the zone lookup fails. * * Since daylight savings time can result in a clock being moved backwards, * there is some ambiguity in resolving a wall clock time to the corresponding * UTC time. For example, on November 8 2020 in New York, the time 1:30 AM * occurs twice: once before the timezone boundary of 2:00 AM is reached, and * again after the clock is set back 1 hour to 1:00 AM. This method attempts * to resolve the ambiguity in the most intuitive way. */ fromWall(zoneid: string, wall: number): [number, ZoneInfo] | undefined; /** * Resolve a lowercase time zone id or alias into the canonical proper-cased id. */ resolveId(id: string): string | undefined; /** * UTC zone info. */ utcZone(): ZoneInfo; /** * Metadata related to a zone, such as the list of country codes that overlap with * the zone, the latitude and longitude, and the current standard offset, in milliseconds. * These can be used to display user interfaces for selecting a zone. * * If the zone identifier does not match a known zone or alias this returns undefined. */ zoneMeta(id: string): ZoneMeta | undefined; /** * Returns an array of time zone ids. */ zoneIds(): string[]; } /** * Implements the time zone lookup. * * @public */ export declare class TzImpl { /** Mapping of canonical time zone ids to index */ private zoneindex; /** Mapping of proper- and lower-cased time zone and alias ids to canonical time zone id */ private linkindex; /** Array of time zone ids */ private _zoneids; /** Array of untils and deltas */ private untilindex; /** Raw un-decoded zone info */ private rawzoneinfo; /** Decoded zone records */ private zonerecords; /** Default UTC zone here for quick access */ private utcinfo; constructor(raw: RawData); /** * Get the info for a time zone using a UTC timestamp. */ fromUTC(zoneid: string, utc: number): ZoneInfo | undefined; /** * Get the info for a time zone using a local "wall clock" timestamp * for that zone. */ fromWall(zoneid: string, wall: number): [number, ZoneInfo] | undefined; /** * UTC zone info. */ utcZone(): ZoneInfo; /** * Resolve a lowercase time zone id or alias into the canonical proper-cased id. */ resolveId(id: string): string | undefined; /** * Metadata related to a zone, such as the list of country codes that overlap with * the zone, the latitude and longitude, and the current standard offset, in milliseconds. * These can be used to display user interfaces for selecting a zone. */ zoneMeta(id: string): ZoneMeta | undefined; /** * Returns an array of time zone ids. */ zoneIds(): string[]; /** * Lookup the time zone record and return the zone info. */ private lookup; /** * Find a record for a time zone id or alias. */ private record; } /** * Global instance for accessing time zones. * * @public */ export declare const TZ: Tz;