1 -- | Parse W3C Date and Time string.
2 module Data.Time.W3C.Parser
7 import qualified Text.Parsec as P
9 import Data.Convertible
10 import Data.Time.W3C.Parser.Parsec
11 import Data.Time.W3C.Types
13 -- | Parse W3C Date and Time string to anything convertible from
14 -- 'W3CDateTime' type. The most obvious acceptable type is the
15 -- 'W3CDateTime' itself. If the given string is ill-formatted, 'parse'
16 -- returns 'Prelude.Nothing'.
17 parse :: Convertible W3CDateTime t => String -> Maybe t
18 parse src = case P.parse p "" src of
19 Right w3c -> Just (convert w3c)
22 p = do w3c <- w3cDateTime