git.iko.soy/typeable/cabal2nix
on master help sign in
Change datestamp to ISO format.
commit33163dd124b89cf0c0324aac306099fd82758c15 authorksaric <kristijan.saric@iohk.io> dateMon 20 Nov 2017, 21:31 (9 years ago) parent678dcc2
1 file changed+5−5
src/Cabal2nix.hs+5−5
src/Cabal2nix.hs+5−5
@@ -79,15 +79,15 @@ options = Options
7979 <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)
8080 <*> option (readP parsePlatform) (long "system" <> help "target system to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
8181 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
82− <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, example '09.08.2012 10:54 AM'"))
82+ <*> optional (option utcTimeReader (long "hackage-snapshot" <> help "hackage snapshot time, ISO format"))
8383 <*> strArgument (metavar "URI")
8484
85−-- | A parser for the date. Minutes seem to be a good fit if the change is on Hackage is maybe once or twice a month.
86−-- Example: parseTime defaultTimeLocale "%d.%m.%Y %l:%M %p" "09.08.2012 10:54 AM" :: Maybe UTCTime
85+-- | A parser for the date. Hackage updates happen maybe once or twice a month.
86+-- Example: parseTime defaultTimeLocale "%FT%T%QZ" "2017-11-20T12:18:35Z" :: Maybe UTCTime
8787utcTimeReader :: ReadM UTCTime
8888utcTimeReader = eitherReader $ \arg ->
89− case parseTimeM True defaultTimeLocale "%d.%m.%Y %l:%M %p" arg of
90− Nothing -> Left ("Cannot parse date: " ++ arg)
89+ case parseTimeM True defaultTimeLocale "%FT%T%QZ" arg of
90+ Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
9191 Just utcTime -> Right utcTime
9292
9393readP :: P.ReadP a a -> ReadM a