hunt-searchengine-0.3.0.1: A search and indexing engine.

Safe HaskellNone
LanguageHaskell98

Hunt.Index.Schema.Normalize.Date

Description

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"

Synopsis

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

Checks if the string is a date representation (syntactically).

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).