1 -- | (Un)picklers for data types present in The Sports Network XML
10 import Data.Time.Clock ( UTCTime )
11 import Data.Time.Format ( formatTime, parseTime )
12 import System.Locale ( defaultTimeLocale )
13 import Text.XML.HXT.Arrow.Pickle (
16 import Text.XML.HXT.Arrow.Pickle.Xml ( PU )
19 -- | (Un)pickle a UTCTime without the time portion.
23 (to_date, from_date) `xpWrapMaybe` xpText
27 to_date :: String -> Maybe UTCTime
28 to_date = parseTime defaultTimeLocale format
30 from_date :: UTCTime -> String
31 from_date = formatTime defaultTimeLocale format
34 -- | (Un)pickle a UTCTime without the date portion.
38 (to_time, from_time) `xpWrapMaybe` xpText
42 to_time :: String -> Maybe UTCTime
43 to_time = parseTime defaultTimeLocale format
45 from_time :: UTCTime -> String
46 from_time = formatTime defaultTimeLocale format