git.iko.soy/typeable/http-api-data
on master help sign in
Preserve fractions of a second (fix #48)
commit172df1fc75d1791134105eac443d69554e15d6bc authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateThu 20 Apr 2017, 22:14 (9 years ago) parentf470704
1 file changed+5−5
src/Web/Internal/HttpApiData.hs+5−5
src/Web/Internal/HttpApiData.hs+5−5
@@ -459,21 +459,21 @@ timeToUrlPiece fmt = T.pack . formatTime defaultTimeLocale (iso8601DateFormat (J
459459-- >>> toUrlPiece $ LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 01)
460460-- "2015-10-03T14:55:01"
461461instance ToHttpApiData LocalTime where
462− toUrlPiece = timeToUrlPiece "%H:%M:%S"
462+ toUrlPiece = timeToUrlPiece "%H:%M:%S%Q"
463463 toEncodedUrlPiece = unsafeToEncodedUrlPiece
464464
465465-- |
466466-- >>> toUrlPiece $ ZonedTime (LocalTime (fromGregorian 2015 10 03) (TimeOfDay 14 55 01)) utc
467467-- "2015-10-03T14:55:01+0000"
468468instance ToHttpApiData ZonedTime where
469− toUrlPiece = timeToUrlPiece "%H:%M:%S%z"
469+ toUrlPiece = timeToUrlPiece "%H:%M:%S%Q%z"
470470 toEncodedUrlPiece = unsafeToEncodedUrlPiece
471471
472472-- |
473−-- >>> toUrlPiece $ UTCTime (fromGregorian 2015 10 03) 864
474−-- "2015-10-03T00:14:24Z"
473+-- >>> toUrlPiece $ UTCTime (fromGregorian 2015 10 03) 864.5
474+-- "2015-10-03T00:14:24.5Z"
475475instance ToHttpApiData UTCTime where
476− toUrlPiece = timeToUrlPiece "%H:%M:%SZ"
476+ toUrlPiece = timeToUrlPiece "%H:%M:%S%QZ"
477477 toEncodedUrlPiece = unsafeToEncodedUrlPiece
478478
479479instance ToHttpApiData NominalDiffTime where