File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -694,4 +694,26 @@ printf '[\n {\n "a": 1\n }\n]\n' > $d/expected
694
694
$JQ --indent 6 -n " [{a:1}]" > $d /out
695
695
cmp $d /out $d /expected
696
696
697
+ if ! $msys && ! $mingw ; then
698
+ # Test handling of timezones -- #2429, #2475
699
+ if ! r=$( TZ=Asia/Tokyo $JQ -rn ' 1731627341 | strflocaltime("%F %T %z %Z")' ) \
700
+ || [ " $r " != " 2024-11-15 08:35:41 +0900 JST" ]; then
701
+ echo " Incorrectly formatted local time"
702
+ exit 1
703
+ fi
704
+
705
+ if ! r=$( TZ=Europe/Paris $JQ -rn ' 1731627341 | strflocaltime("%F %T %z %Z")' ) \
706
+ || [ " $r " != " 2024-11-15 00:35:41 +0100 CET" ]; then
707
+ echo " Incorrectly formatted local time"
708
+ exit 1
709
+ fi
710
+
711
+ if ! r=$( TZ=Europe/Paris $JQ -rn ' 1731627341 | strftime("%F %T %z %Z")' ) \
712
+ || ( [ " $r " != " 2024-11-14 23:35:41 +0000 UTC" ] \
713
+ && [ " $r " != " 2024-11-14 23:35:41 +0000 GMT" ] ); then
714
+ echo " Incorrectly formatted universal time"
715
+ exit 1
716
+ fi
717
+ fi
718
+
697
719
exit 0
You can’t perform that action at this time.
0 commit comments