summaryrefslogtreecommitdiff
path: root/sax/qa
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-30 02:05:25 +0100
committerEike Rathke <erack@redhat.com>2011-11-30 02:05:25 +0100
commit7613359985a89a42417a746bcdbb25f072784733 (patch)
treed7ed828c6839d323a1766adeaf57b92e3b8b8e88 /sax/qa
parent07a7b2937a9427b2feb3307804ec0f527091bb92 (diff)
handle dates with year < 1000
* Read dates with years consisting of less than 4 digits. ISO 8601 specifies that years are to be written with a minimum of 4 digits. However, be lenient in what we accept. * Write years < 1000 with leading zeros to comply with ISO 8601 YYYY.
Diffstat (limited to 'sax/qa')
-rw-r--r--sax/qa/cppunit/test_converter.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 923c7eb2413e..17d1303e901c 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -215,8 +215,13 @@ void ConverterTest::testDateTime()
doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
/*(0, 0, 0, 0, 2, 1, 333)*/,
"0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
- doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+
- doTestDateTimeF( "1-01-01T00:00:00" ); // invalid: < 4 Y
+ // A leading ^+ is NOT invalid, ISO 8601 specifies this for explicit AD/CE.
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "+0001-01-01T00:00:00", "0001-01-01T00:00:00" );
+ // While ISO 8601 specifies a minimum of 4 year digits we are lenient in
+ // what we accept.
+ doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
+ "1-01-01T00:00:00", "0001-01-01T00:00:00" );
doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D
doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H