ebird-api-0.2.0.0: A Haskell description of the eBird API
Copyright(c) 2023 Finley McIlwaine
LicenseMIT (see LICENSE)
MaintainerFinley McIlwaine <finleymcilwaine@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.EBird.API.Util.Time

Description

Utilities for parsing and printing dates and times that the eBird API provides.

Synopsis

Date and time types

newtype EBirdDate Source #

An EBirdDate is simply a Day.

Constructors

EBirdDate 

Fields

Instances

Instances details
IsString EBirdDate Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Util.Time

Enum EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Read EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Show EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

EBirdString EBirdDate Source #

eBird dates are formatted as YYYY-MM-DD, with 0 padding where necessary.

Instance details

Defined in Data.EBird.API.Util.Time

Eq EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Ord EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

FromJSON EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

ToJSON EBirdDate Source # 
Instance details

Defined in Data.EBird.API.Util.Time

newtype EBirdTime Source #

Since times that come from the eBird API are not provided with a time zone, an EBirdTime is simply a TimeOfDay. Since eBird times are only provided up to the minute, the todSec value will always be 0.

Constructors

EBirdTime 

Fields

Instances

Instances details
IsString EBirdTime Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Util.Time

Read EBirdTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Show EBirdTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

EBirdString EBirdTime Source #

eBird times are formatted as HH:MM, with 0 padding where necessary.

Instance details

Defined in Data.EBird.API.Util.Time

Eq EBirdTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Ord EBirdTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

FromJSON EBirdTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

ToJSON EBirdTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

newtype EBirdDateTime Source #

Dates and times that come from the eBird API are not provided with a time zone. All we can do is track the Day and TimeOfDay with a LocalTime. Comparison of, for example, Observations that happened in different time zones must therefore be done carefully.

Constructors

EBirdDateTime 

Instances

Instances details
IsString EBirdDateTime Source #

Use this instance carefully! It throws runtime exceptions if the string is malformatted.

Instance details

Defined in Data.EBird.API.Util.Time

Read EBirdDateTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Show EBirdDateTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

EBirdString EBirdDateTime Source #

eBird datetimes are formatted as YYYY-MM-DD HH:MM, with 0 padding where necessary.

Instance details

Defined in Data.EBird.API.Util.Time

Eq EBirdDateTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Ord EBirdDateTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

FromJSON EBirdDateTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

ToJSON EBirdDateTime Source # 
Instance details

Defined in Data.EBird.API.Util.Time

Conversions

eBirdDateToGregorian :: EBirdDate -> (Integer, Integer, Integer) Source #

Convert an EBirdDate to a gregorian representation. The first element is the year, the second is the month in the year (1 - 12), and the third is the day in the month.

attoparsec parsers

parseEBirdDate :: Parser EBirdDate Source #

Parse an eBird date. Most eBird dates are formatted as YYYY-MM-DD, but the ChecklistFeedAPI gives dates in a format like "19 Jul 2023". So, we try parsing the first format using day, and then use a custom parseTimeM format for the latter format if that fails.

parseEBirdTime :: Parser EBirdTime Source #

Parse an eBird time (just uses timeOfDay).

parseEBirdDateTime :: Parser EBirdDateTime Source #

Parse an eBird datetime (just uses localTime).