Branch: Tag:

2014-08-28

2014-08-28 15:52:47 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Calendar: Improved dwim_time() for ISO-8601 dates.

Also adds some corresponding testsuite tests.

FIXME: Ought to have tests for all the patterns in dwim_{day,time}().

28:   dnl Some more or less odd timezones encountered by Xenofarm:   define(test_dwim,[[    test_eq(Calendar.ISO.set_timezone("CET")->dwim_time($1)->format_time(),"2002-11-19 07:04:03") +  ifelse($2,,,[[    test_eq(Calendar.ISO.set_timezone("CET")->dwim_time($1)->tzname(),$2)    ]]) -  + ]])   test_dwim("Tue Nov 19 07:04:03 MET 2002","MET")   test_dwim("Tue Nov 19 07:04:03 CST 2002","CST")   test_dwim("Tue Nov 19 07:04:03 CET 2002","CET")
42:   test_dwim([["Tue, 19 Nov 2002 07:04:03 GMT"]],"GMT")   test_dwim([["Tuesday, 19-Nov-02 07:04:03 GMT"]],"GMT")   test_dwim("Tue Nov 19 07:04:03 2002","GMT") + test_dwim("20021119T070403 GMT","GMT") + test_dwim("20021119T070403") + test_dwim("20021119 070403 GMT","GMT") + test_dwim("20021119 070403")      define(test_http,[[    test_eq(Calendar.ISO.http_time($1)->format_time(),$2)