UNPKG

@hebcal/core

Version:

A perpetual Jewish Calendar API

74 lines (73 loc) 3.48 kB
import { GeoLocation } from '@hebcal/noaa'; /** Class representing Location */ export declare class Location extends GeoLocation { private readonly il; private readonly cc?; private readonly geoid?; /** * Initialize a Location instance * @param latitude - Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003) * @param longitude - Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005) * @param il - in Israel (true) or Diaspora (false) * @param tzid - Olson timezone ID, e.g. "America/Chicago" * @param [cityName] - optional descriptive city name * @param [countryCode] - ISO 3166 alpha-2 country code (e.g. "FR") * @param [geoid] - optional string or numeric geographic ID * @param [elevation] - in meters (default `0`) */ constructor(latitude: number, longitude: number, il: boolean, tzid: string, cityName?: string, countryCode?: string, geoid?: string | number, elevation?: number); getIsrael(): boolean; getName(): string | null; /** * Returns the location name, up to the first comma */ getShortName(): string | null; getCountryCode(): string | undefined; getTzid(): string; /** * Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location */ getTimeFormatter(): Intl.DateTimeFormat; getGeoId(): string | number | undefined; /** * Creates a location object from one of 60 "classic" Hebcal city names. * The following city names are supported: * 'Ashdod', 'Atlanta', 'Austin', 'Baghdad', 'Beer Sheva', * 'Berlin', 'Baltimore', 'Bogota', 'Boston', 'Budapest', * 'Buenos Aires', 'Buffalo', 'Chicago', 'Cincinnati', 'Cleveland', * 'Dallas', 'Denver', 'Detroit', 'Eilat', 'Gibraltar', 'Haifa', * 'Hawaii', 'Helsinki', 'Houston', 'Jerusalem', 'Johannesburg', * 'Kiev', 'La Paz', 'Livingston', 'Las Vegas', 'London', 'Los Angeles', * 'Marseilles', 'Miami', 'Minneapolis', 'Melbourne', 'Mexico City', * 'Montreal', 'Moscow', 'New York', 'Omaha', 'Ottawa', 'Panama City', * 'Paris', 'Pawtucket', 'Petach Tikvah', 'Philadelphia', 'Phoenix', * 'Pittsburgh', 'Providence', 'Portland', 'Saint Louis', 'Saint Petersburg', * 'San Diego', 'San Francisco', 'Sao Paulo', 'Seattle', 'Sydney', * 'Tel Aviv', 'Tiberias', 'Toronto', 'Vancouver', 'White Plains', * 'Washington DC', 'Worcester' * @param name */ static lookup(name: string): Location | undefined; toString(): string; /** * Converts legacy Hebcal timezone to a standard Olson tzid. * @param tz integer, GMT offset in hours * @param dst 'none', 'eu', 'usa', or 'israel' */ static legacyTzToTzid(tz: number, dst: string): string | undefined; /** * Converts timezone info from Zip-Codes.com to a standard Olson tzid. * @example * Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver' * @param state two-letter all-caps US state abbreviation like 'CA' * @param tz positive number, 5=America/New_York, 8=America/Los_Angeles * @param dst single char 'Y' or 'N' */ static getUsaTzid(state: string, tz: number, dst: string): string; /** * Adds a location name for `Location.lookup()` only if the name isn't * already being used. Returns `false` if the name is already taken * and `true` if successfully added. */ static addLocation(cityName: string, location: Location): boolean; }