From c3b60abd05d9e484626d84b57bbe6e3350f4e942 Mon Sep 17 00:00:00 2001 From: Gabriella Gonzalez Date: Thu, 3 Feb 2022 06:58:01 -0800 Subject: [PATCH] Fix pretty-printing of timezones Fixes https://github.com/dhall-lang/dhall-haskell/issues/2368 --- dhall/src/Dhall/Pretty/Internal.hs | 2 +- dhall/tests/format/negativeTimeZoneA.dhall | 1 + dhall/tests/format/negativeTimeZoneB.dhall | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 dhall/tests/format/negativeTimeZoneA.dhall create mode 100644 dhall/tests/format/negativeTimeZoneB.dhall diff --git a/dhall/src/Dhall/Pretty/Internal.hs b/dhall/src/Dhall/Pretty/Internal.hs index 0941bbbdc..bf3bf09db 100644 --- a/dhall/src/Dhall/Pretty/Internal.hs +++ b/dhall/src/Dhall/Pretty/Internal.hs @@ -1354,7 +1354,7 @@ prettyPrinters characterSet = where sign = if 0 <= minutes then "+" else "-" - (_HH, _MM) = minutes `divMod` 60 + (_HH, _MM) = abs minutes `divMod` 60 prettyPrimitiveExpression List = builtin "List" prettyPrimitiveExpression ListBuild = diff --git a/dhall/tests/format/negativeTimeZoneA.dhall b/dhall/tests/format/negativeTimeZoneA.dhall new file mode 100644 index 000000000..7b7c93321 --- /dev/null +++ b/dhall/tests/format/negativeTimeZoneA.dhall @@ -0,0 +1 @@ +04:00:00-04:00 diff --git a/dhall/tests/format/negativeTimeZoneB.dhall b/dhall/tests/format/negativeTimeZoneB.dhall new file mode 100644 index 000000000..7b7c93321 --- /dev/null +++ b/dhall/tests/format/negativeTimeZoneB.dhall @@ -0,0 +1 @@ +04:00:00-04:00