From 1377dd2221010b67fdf9127ce41fa2dbefe94b98 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sat, 14 Nov 2020 15:02:43 -0800 Subject: date: add --iso and the %:z output format. I didn't know until implementing this that --iso is actually called --iso-8601 and that GNU date will actually accept any prefix. --iso-8 works fine too. I've assumed that --iso (that I always used) and --iso-8601 (as given in the documentation) are the only two that matter. --- tests/date.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/date.test b/tests/date.test index 9240131a..6aaf937e 100644 --- a/tests/date.test +++ b/tests/date.test @@ -53,6 +53,21 @@ testing "trailing %" "touch -d 2012-01-23T12:34:56.123456789 f && date -r f +%Y% testing "just %" "touch -d 2012-01-23T12:34:56.123456789 f && date -r f +%" "%\n" "" "" rm -f f +# Test --iso... +testing "-I" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -I" \ + "2012-01-23\n" "" "" +testing "-Id" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Id" \ + "2012-01-23\n" "" "" +testing "-Ih" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Ih" \ + "2012-01-23T12+00:00\n" "" "" +testing "-Im" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Im" \ + "2012-01-23T12:34+00:00\n" "" "" +testing "-Is" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Is" \ + "2012-01-23T12:34:56+00:00\n" "" "" +testing "-In" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -In" \ + "2012-01-23T12:34:56,123456789+00:00\n" "" "" +rm -f f + # Test embedded TZ to take a date in one time zone and display it in another. testing "TZ=" "TZ='America/Los_Angeles' date -d 'TZ=\"Europe/Berlin\" 2018-01-04 08:00'" "Wed Jan 3 23:00:00 PST 2018\n" "" "" testing "TZ=" "TZ='America/Los_Angeles' date -d 'TZ=\"Europe/Berlin\" 2018-10-04 08:00'" "Wed Oct 3 23:00:00 PDT 2018\n" "" "" -- cgit v1.2.3