Initialize a Location instance
Latitude as a decimal, valid range -90 thru +90 (e.g. 41.85003)
Longitude as a decimal, valid range -180 thru +180 (e.g. -87.65005)
in Israel (true) or Diaspora (false)
Olson timezone ID, e.g. "America/Chicago"
OptionalcityName: stringoptional descriptive city name
OptionalcountryCode: stringISO 3166 alpha-2 country code (e.g. "FR")
Optionalgeoid: string | numberoptional string or numeric geographic ID
Optionalelevation: numberin meters (default 0)
Optionaladmin1OptionalasciinameProtectedelevationOptionalgeoProtectedlatitudeProtectedlocationProtectedlongitudeOptionalpopulationOptionalstateProtectedtimeOptionalzipReturns the ISO 3166 alpha-2 country code (e.g. "US", "IL", "FR")
passed to the constructor, or undefined if none was provided.
Method to get the elevation in Meters.
Returns the elevation in Meters.
Returns the optional geographic identifier passed to the constructor
(typically a GeoNames numeric ID or a US Zip Code string), or
undefined if none was provided.
Returns true if this location is in Israel (uses the Israeli holiday
and Torah-reading schedule), false for the Diaspora.
Returns the latitude.
Returns the location name.
Returns the longitude.
Returns the location name truncated at the first comma. Useful for compact display where only the city name is desired.
Special-cased so that US locations of the form "Washington, DC" or
"Washington, D.C., ..." keep the DC / D.C. suffix attached.
Returns a cached 24-hour Intl.DateTimeFormat (e.g. 07:41 or 20:03)
configured for this location's timezone. Formatters are memoized by
timezone so repeated calls do not allocate.
Returns the timeZone.
Returns the Olson timezone identifier (e.g. "America/Chicago").
Alias for getTimeZone() from the parent GeoLocation class.
Method to set the elevation in Meters above sea level.
The elevation to set in Meters. An Error will be thrown if the value is a negative.
The setter method for the display name.
Method to set the TimeZone.
The timeZone to set.
Returns a JSON-serialized representation of this Location. Useful for debugging and structured logging.
StaticaddRegisters a new named location with the built-in Location.lookup()
registry. Names are stored case-insensitively. Returns false if a
location with the same (lower-cased) name is already registered, and
true if successfully added.
Use this to extend the built-in set of ~60 classic Hebcal cities with your own custom locations.
StaticgetConverts timezone info from Zip-Codes.com to a standard Olson tzid.
two-letter all-caps US state abbreviation like 'CA'
positive number, 5=America/New_York, 8=America/Los_Angeles
single char 'Y' or 'N'
StaticlegacyConverts a legacy Hebcal-style timezone (a numeric GMT offset plus a coarse DST region) to a standard IANA/Olson timezone ID.
This exists to migrate data from older Hebcal versions that stored timezones as GMT offset + DST scheme rather than as a full tzid.
integer, GMT offset in hours
'none', 'eu', 'usa', or 'israel'
StaticlookupCreates 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'
Lookups are case-insensitive. Returns undefined if the name is not
recognized. The list can be extended with Location.addLocation.
case-insensitive classic city name
Class representing a geographic location for use with candle-lighting, havdalah, and zmanim calculations.
Extends GeoLocation from
@hebcal/noaawith Jewish-calendar specific data: an Israel/Diaspora flag, ISO country code, and an optional geographic identifier. Also provides Location.lookup for ~60 built-in "classic" Hebcal cities.Example