Class Location

Class representing Location

Hierarchy (view full)

Constructors

  • Initialize a Location instance

    Parameters

    • latitude: number

      Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)

    • longitude: number

      Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)

    • il: boolean

      in Israel (true) or Diaspora (false)

    • tzid: string

      Olson timezone ID, e.g. "America/Chicago"

    • OptionalcityName: string

      optional descriptive city name

    • OptionalcountryCode: string

      ISO 3166 alpha-2 country code (e.g. "FR")

    • Optionalgeoid: string | number

      optional string or numeric geographic ID

    • Optionalelevation: number

      in meters (default 0)

    Returns Location

Methods

  • Method to get the elevation in Meters.

    Returns number

    Returns the elevation in Meters.

  • Returns undefined | string | number

  • Returns number

    Returns the latitude.

  • Returns null | string

    Returns the location name.

  • Returns number

    Returns the longitude.

  • Returns the location name, up to the first comma

    Returns null | string

  • Gets a 24-hour time formatter (e.g. 07:41 or 20:03) for this location

    Returns DateTimeFormat

  • Returns string

    Returns the timeZone.

  • Method to set the elevation in Meters above sea level.

    Parameters

    • elevation: number

      The elevation to set in Meters. An Error will be thrown if the value is a negative.

    Returns void

  • Parameters

    • latitude: number

    Returns void

  • Parameters

    • name: null | string

      The setter method for the display name.

    Returns void

  • Parameters

    • longitude: number

    Returns void

  • Method to set the TimeZone.

    Parameters

    • timeZoneId: string

      The timeZone to set.

    Returns void

  • Returns a string representation of an object.

    Returns 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.

    Parameters

    Returns boolean

  • Converts timezone info from Zip-Codes.com to a standard Olson tzid.

    Parameters

    • state: string

      two-letter all-caps US state abbreviation like 'CA'

    • tz: number

      positive number, 5=America/New_York, 8=America/Los_Angeles

    • dst: string

      single char 'Y' or 'N'

    Returns string

    Location.getUsaTzid('AZ', 7, 'Y') // 'America/Denver'
    
  • Converts legacy Hebcal timezone to a standard Olson tzid.

    Parameters

    • tz: number

      integer, GMT offset in hours

    • dst: string

      'none', 'eu', 'usa', or 'israel'

    Returns undefined | string

  • 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'

    Parameters

    • name: string

    Returns undefined | Location