Safe Haskell | None |
---|---|
Language | Haskell98 |
Normalization and validation for date.
Days are represented here as in ISO 8601:2000 Second Edition: ISO (International Organization for Standardization). Representations of dates and times, second edition, 2000-12-15.
NOT as in ISO 8601 ISO (International Organization for Standardization). Representations of dates and times, 1988-06-15.
The main difference is dealing with year 0. in the older ISO standard, this is excluded and "-0001" is the representation of year 1 Before Common Era "-1 BCE". In the latter standard "0000" represents "-1 BCE" and "-0001" represents "-2 BCE"
- normalize :: Text -> Text
- denormalize :: Text -> Text
- isAnyDate :: String -> Bool
- isAnyDate' :: String -> Bool
- isTime :: String -> Bool
- nullDay :: Day
- showGYearMonth :: Date -> String
- showGYear :: Date -> String
- showGMonthDay :: Date -> String
- showGMonth :: Date -> String
- showGDay :: Date -> String
- showTime :: Date -> String
Documentation
normalize :: Text -> Text Source
Normalize a date representation to store in the index or search for.
denormalize :: Text -> Text Source
Function takes normalized Date and transforms it back a readable form. We don't transform it back to the original representation, since that is never used, but to a general readable date format
isAnyDate' :: String -> Bool Source
Same as isAnyDate
but also checks if (showDate . readAnyDate)
produces the same result.
NOTE: excludes dates before year 0 (1 BCE).
showGYearMonth :: Date -> String Source
showGMonthDay :: Date -> String Source
showGMonth :: Date -> String Source