| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Codec.JSON.Encoder.Time
Description
Functions for encoding common time formats in RFC 8259 JSONs.
Synopsis
- year :: Year -> Encoder
- quarter :: Quarter -> Encoder
- month :: Month -> Encoder
- monthDate :: Day -> Encoder
- weekDate :: Day -> Encoder
- ordinalDate :: Day -> Encoder
- timeOfDay :: TimeOfDay -> Encoder
- localTime :: LocalTime -> Encoder
- utcTime :: UTCTime -> Encoder
- timeZone :: TimeZone -> Encoder
- zonedTime :: ZonedTime -> Encoder
Calendar
year :: Year -> Encoder Source #
Encode a year as a JSON string in ISO 8601 extended [-…y]yyyy format
Compatible with RFC 3339 if the year is in the \([0,10000)\) interval.
quarter :: Quarter -> Encoder Source #
Encode a year quarter as a JSON string in [-…y]yyyy-Qq format.
Note that year quarters are not defined by ISO 8601, this is an informal convention.
Month
month :: Month -> Encoder Source #
Encode a month date as a JSON string, in ISO 8601 extended [-…y]yyyy-mm format.
RFC 3339 compatibility matches that of the year function.
monthDate :: Day -> Encoder Source #
Encode a month date as a JSON string in ISO 8601 extended [-…y]yyyy-mm-dd format.
RFC 3339 compatibility matches that of the year function.
Week
weekDate :: Day -> Encoder Source #
Encode a week date as a JSON string in ISO 8601 extended [-…y]yyyy-Www-d format.
Ordinal
ordinalDate :: Day -> Encoder Source #
Encode an ordinal date as a JSON string in ISO 8601 extended [-…y]yyyy-ddd format.
Time of day
timeOfDay :: TimeOfDay -> Encoder Source #
Encode a time of day as a JSON string in RFC 3339 hh:mm:ss[.s…] format.
Local
localTime :: LocalTime -> Encoder Source #
Encode a local time as a JSON string in ISO 8601 extended
[-…y]yyyy-mm-ddThh:mm:ss[.s…] format.
RFC 3339 compatibility matches that of the year function.
Zoned
utcTime :: UTCTime -> Encoder Source #
Encode a UTC time as a JSON string in ISO 8601 extended
[-…y]yyyy-mm-ddThh:mm:ss[.s…]Z format.
RFC 3339 compatibility matches that of the year function.