--- | The format string for a time_stamp. We keep the leading/trailing
--- space so that parseTime and formatTime are inverses are one
--- another, even though there is some confusion as to how these two
--- functions should behave:
+-- | The format string for a time_stamp. We have removed the
+-- leading/trailing space so that parseTime and formatTime are NOT
+-- inverses of one another. We should be able to rectify this once
+-- everything is updated to support time-1.5. See,
--
-- <https://ghc.haskell.org/trac/ghc/ticket/9150>
--
time_stamp_format :: String
-time_stamp_format = " %B %-d, %Y, at " ++ time_format ++ " ET "
+time_stamp_format = "%B %-d, %Y, at " ++ time_format ++ " ET"
xp_time_stamp =
(parse_time_stamp, from_time_stamp) `xpWrapMaybe` xpText
where
+ -- | We have to re-pad the time_stamp_format with a leading and
+ -- trailing space; see the documentation of 'time_stamp_format'
+ -- for more information.
from_time_stamp :: UTCTime -> String
from_time_stamp =
- formatTime defaultTimeLocale time_stamp_format
+ formatTime defaultTimeLocale (" " ++ time_stamp_format ++ " ")