1 module Data.Time.W3CDateTime
6 import Data.Convertible
12 -- This data type is /partially ordered/ so we can't make it an
13 -- instance of Ord (e.g. "2010" and "2010-01" can't be compared).
17 , w3cMonth :: !(Maybe Int)
18 , w3cDay :: !(Maybe Int)
19 , w3cHour :: !(Maybe Int)
20 , w3cMinute :: !(Maybe Int)
21 , w3cSecond :: !(Maybe Pico)
22 , w3cTimeZone :: !(Maybe TimeZone)
24 deriving (Show, Eq, Typeable)
34 , w3cTimeZone = Nothing
37 instance Convertible Day W3CDateTime where
39 = case toGregorian day of
40 (y, m, d) -> return empty {
46 instance Convertible W3CDateTime Day where
48 = do let y = w3cYear w3c
49 m <- case w3cMonth w3c of
51 Nothing -> convError "No month info" w3c
52 d <- case w3cDay w3c of
54 Nothing -> convError "No day info" w3c
55 return $ fromGregorian y m d