One more date fix

Thing is, previously DDay contained only date and '%H:%M:%S' resulted
in an empty string so the whole date was '2021-01-01T::' which is wrong.
parent 7590b242
......@@ -82,8 +82,10 @@ parseTimeE :: (MonadFail m, DTF.ParseTime t) => Text -> Text -> m t
parseTimeE fmt s = case (DTF.parseTimeM True DTF.defaultTimeLocale (T.unpack fmt) (T.unpack s)) of
Nothing -> fail $ "Cannot parse date with format " <> T.unpack fmt
Just p -> pure p
-- | Convert to ISO text format
showDate :: Date -> Text
showDate (DDay day) = T.pack $ DTF.formatTime DTF.defaultTimeLocale "%Y-%m-%dT%H:%M:%S" day
showDate (DDay day) = T.pack $ DTF.formatTime DTF.defaultTimeLocale "%Y-%m-%dT00:00:00" day
showDate (DUTCTime t) = T.pack $ DTF.formatTime DTF.defaultTimeLocale "%Y-%m-%dT%H:%M:%S" t
data Date = DDay Day | DUTCTime UTCTime
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment