File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -665,4 +665,25 @@ $VALGRIND $Q $JQ . <<\NUM
665
665
-10E-1000000001
666
666
NUM
667
667
668
+ # Test handling of timezones -- #2429, #2475
669
+
670
+ if ! r=$( TZ=Asia/Tokyo $JQ -rn ' 1731627341 | strflocaltime("%F %T %z %Z")' ) \
671
+ || [ " $r " != " 2024-11-15 08:35:41 +0900 JST" ]; then
672
+ echo " Incorrectly formatted local time"
673
+ exit 1
674
+ fi
675
+
676
+ if ! r=$( TZ=Europe/Paris $JQ -rn ' 1731627341 | strflocaltime("%F %T %z %Z")' ) \
677
+ || [ " $r " != " 2024-11-15 00:35:41 +0100 CET" ]; then
678
+ echo " Incorrectly formatted local time"
679
+ exit 1
680
+ fi
681
+
682
+ if ! r=$( TZ=Europe/Paris $JQ -rn ' 1731627341 | strftime("%F %T %z %Z")' ) \
683
+ || ( [ " $r " != " 2024-11-14 23:35:41 +0000 UTC" ] \
684
+ && [ " $r " != " 2024-11-14 23:35:41 +0000 GMT" ] ); then
685
+ echo " Incorrectly formatted universal time"
686
+ exit 1
687
+ fi
688
+
668
689
exit 0
You can’t perform that action at this time.
0 commit comments