Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pretty-printing of Time literals #2466

Merged
merged 3 commits into from
Oct 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dhall/src/Dhall/Pretty/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ prettyPrinters characterSet =

suffix
| precision == 0 = ""
| otherwise = "." <> Pretty.pretty fraction
| otherwise = "." <> Pretty.pretty (Printf.printf "%0*d" precision fraction :: String)
prettyPrimitiveExpression TimeZone =
builtin "TimeZone"
prettyPrimitiveExpression (TimeZoneLiteral (Time.TimeZone minutes _ _)) =
Expand Down
3 changes: 3 additions & 0 deletions dhall/tests/format/timePrecisionA.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This test ensures that we don't strip leading zeros from the fractional
-- component of seconds when pretty-printing them
00:00:00.01
3 changes: 3 additions & 0 deletions dhall/tests/format/timePrecisionB.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- This test ensures that we don't strip leading zeros from the fractional
-- component of seconds when pretty-printing them
00:00:00.01