Portability | POSIX |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Exposes utilities derived from the excellent ZoneDetect library https://github.com/BertoldVdb/ZoneDetect. To use this module, you need to obtain database files from the aforementioned library's server.
Currently, only one function for looking up the name of a Timezone is provided, but the underlying library also has richer functions for opening timezone database files, finding applicable zones, etc.
Synopsis
- type TimezoneName = String
- lookupTimezone :: FilePath -> Float -> Float -> Either String TimezoneName
Documentation
type TimezoneName = String Source #
Alias for clarity, timezones are short strings that follow the IANA conventions documented here: https://data.iana.org/time-zones/tz-link.html
lookupTimezone :: FilePath -> Float -> Float -> Either String TimezoneName Source #
Given a timezone database, latitude and longitude, try to determine the timezone name. Follow the instructions in the C library's repository to obtain timezone database files (https://github.com/BertoldVdb/ZoneDetect/tree/05567e367576d7f3efa00083b7661a01e43dc8ca/database) Once in possesion of said files, the lookup looks as follows:
>>>
lookupTimezone "./test/tz_db/timezone21.bin" 40.7831 (-73.9712)
Right "America/New_York"
Failure conditions are: invalid database file, or invalid coordinates,
both are returned as Left
values.