git.iko.soy/typeable/cabal2nix
on master help sign in
Change datestamp to ISO format.
33163ddksaric
src/Cabal2nix.hs+5−5
@@ -79,15 +79,15 @@ options = Options
79 <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)
79 <*> option (readP parse) (long "compiler" <> help "compiler to use when evaluating the Cabal file" <> value buildCompilerId <> showDefaultWith display)
80 <*> option (readP parsePlatform) (long "system" <> help "target system to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
80 <*> option (readP parsePlatform) (long "system" <> help "target system to use when evaluating the Cabal file" <> value buildPlatform <> showDefaultWith display)
81 <*> optional (strOption $ long "subpath" <> metavar "PATH" <> help "Path to Cabal file's directory relative to the URI (default is root directory)")
81 <*> 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"))
83 <*> strArgument (metavar "URI")
83 <*> strArgument (metavar "URI")
84
84
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.
85+-- | A parser for the date. Hackage updates happen maybe once or twice a month.
86−-- Example: parseTime defaultTimeLocale "%d.%m.%Y %l:%M %p" "09.08.2012 10:54 AM" :: Maybe UTCTime
86+-- Example: parseTime defaultTimeLocale "%FT%T%QZ" "2017-11-20T12:18:35Z" :: Maybe UTCTime
87utcTimeReader :: ReadM UTCTime
87utcTimeReader :: ReadM UTCTime
88utcTimeReader = eitherReader $ \arg ->
88utcTimeReader = eitherReader $ \arg ->
89− case parseTimeM True defaultTimeLocale "%d.%m.%Y %l:%M %p" arg of
89+ case parseTimeM True defaultTimeLocale "%FT%T%QZ" arg of
90− Nothing -> Left ("Cannot parse date: " ++ arg)
90+ Nothing -> Left $ "Cannot parse date, ISO format used ('2017-11-20T12:18:35Z'): " ++ arg
91 Just utcTime -> Right utcTime
91 Just utcTime -> Right utcTime
92
92
93readP :: P.ReadP a a -> ReadM a
93readP :: P.ReadP a a -> ReadM a