+-- | Data types defined by this package.
module Data.Time.W3C.Types
( W3CDateTime(..)
)
import Data.Typeable
+-- |'W3CDateTime' represents a W3C Date and Time format.
+--
+-- The field 'w3cYear' is mandatory while other fields are
+-- optional. But you should be careful about combinations of such
+-- optional fields. No combinations are allowed except for the
+-- following list:
+--
+-- * YYYY
+--
+-- * YYYY-MM
+--
+-- * YYYY-MM-DD
+--
+-- * YYYY-MM-DDThh:mmTZD
+--
+-- * YYYY-MM-DDThh:mm:ss.sTZD
+--
-- This data type is /partially ordered/ so we can't make it an
--- instance of Ord (e.g. "2010" and "2010-01" can't be compared).
+-- instance of Ord (e.g. @\"2010\"@ and @\"2010-01\"@ can't be
+-- compared).
data W3CDateTime
= W3CDateTime {
w3cYear :: !Integer
Nothing -> convError ("No " ++ name ++ " information in the given value") a
Just b -> return b
+instance Convertible W3CDateTime W3CDateTime where
+ safeConvert = return
+
instance Convertible Day W3CDateTime where
safeConvert day
= case toGregorian day of