packages feed

xsd 0.3.4.1 → 0.3.5

raw patch · 2 files changed

+9/−5 lines, 2 filesnew-uploader

Files

Text/XML/XSD/DateTime.hs view
@@ -14,6 +14,7 @@                             ) where  import Text.ParserCombinators.Parsec+import Data.Char import Data.Ord import Data.Maybe import Data.Time@@ -24,6 +25,8 @@ -- | XSD @dateTime@ data structure <http://www.w3.org/TR/xmlschema-2/#dateTime> data DateTime = DateTime Bool Int Int Int Int Int Int (Maybe String) Offset +dateTimeConstr neg yy mm dd hhh mmm sss ssss tz = DateTime neg yy mm dd hhh mmm sss (fmap (filter isDigit) ssss) tz+ instance Show DateTime where   show (DateTime neg yy mm dd hhh mmm sss ssss tz) =     join [if neg then "-" else [], showy yy, "-", showi mm, "-", showi dd, "T", showi hhh, ":", showi mmm, ":", showi sss, seconds ssss,show tz]@@ -58,7 +61,7 @@   let (yy, mm, dd) = toGregorian d       (sss1, sss2) = properFraction sss       (hz, mz) = m `quotRem` 60-  in DateTime (yy < 0) (abs (fromIntegral yy)) mm dd hhh mmm sss1 (Just (trimTail (== '0') (show sss2))) (Offset False (Just (hz < 0)) (Just hz) (Just mz))+  in dateTimeConstr (yy < 0) (abs (fromIntegral yy)) mm dd hhh mmm sss1 (Just (trimTail (== '0') (drop 2 $ show sss2))) (Offset False (Just (hz < 0)) (Just hz) (Just mz))  -- | Parses the string in a @dateTime@ then converts to a zoned time and may fail with a parse error. zonedTime' :: String -> Either ParseError ZonedTime@@ -78,7 +81,7 @@   let (yy, mm, dd) = toGregorian d       TimeOfDay hhh mmm sss = timeToTimeOfDay t       (sss1, sss2) = properFraction sss-  in DateTime (yy < 0) (abs (fromIntegral yy)) mm dd hhh mmm sss1 (Just (trimTail (== '0') (show sss2))) (Offset True Nothing Nothing Nothing)+  in dateTimeConstr (yy < 0) (abs (fromIntegral yy)) mm dd hhh mmm sss1 (Just (trimTail (== '0') (drop 2 $ show sss2))) (Offset True Nothing Nothing Nothing)  -- | Parses the string in a @dateTime@ then converts to a UTC time and may fail with a parse error. utcTime' :: String -> Either ParseError UTCTime@@ -106,6 +109,7 @@ timeZone _ = error "Offset invariant not met"  seconds :: Maybe String -> String+seconds (Just "") = [] seconds (Just d) = '.' : d seconds Nothing = [] @@ -132,7 +136,7 @@                    char '-'                    mm <- p2imax 12                    char '-'-                   dd <- p2imax ([31, if isLeapYear (fromIntegral yy) then 29 else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] !! (mm - 1))+                   dd <- p2imax ([31, if isLeapYear (fromIntegral mm) then 29 else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] !! (mm - 1))                    char 'T'                    hhh <- p2imax 23                    char ':'@@ -141,7 +145,7 @@                    sss <- p2imax 59                    ssss <- optionMaybe fractionalSeconds                    o <- parseOffset-                   return (DateTime neg yy mm dd hhh mmm sss ssss o)+                   return (dateTimeConstr neg yy mm dd hhh mmm sss ssss o)  yearParser :: GenParser Char st Int yearParser = do d1 <- digit
xsd.cabal view
@@ -1,5 +1,5 @@ Name:                xsd-Version:             0.3.4.1+Version:             0.3.5 License:             BSD3 License-File:        LICENSE Synopsis:            XML Schema data structures