we are W3C XMLSchema here, not ISO 8601
This commit is contained in:
@@ -215,13 +215,11 @@ void ConverterTest::testDateTime()
|
|||||||
doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
|
doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333)
|
||||||
/*(0, 0, 0, 0, 2, 1, 333)*/,
|
/*(0, 0, 0, 0, 2, 1, 333)*/,
|
||||||
"0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
|
"0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ );
|
||||||
// A leading ^+ is NOT invalid, ISO 8601 specifies this for explicit AD/CE.
|
// While W3C XMLSchema specifies a minimum of 4 year digits we are lenient
|
||||||
doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
|
// in what we accept.
|
||||||
"+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),
|
doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1),
|
||||||
"1-01-01T00:00:00", "0001-01-01T00:00:00" );
|
"1-01-01T00:00:00", "0001-01-01T00:00:00" );
|
||||||
|
doTestDateTimeF( "+0001-01-01T00:00:00" ); // invalid: ^+
|
||||||
doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
|
doTestDateTimeF( "0001-1-01T00:00:00" ); // invalid: < 2 M
|
||||||
doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D
|
doTestDateTimeF( "0001-01-1T00:00:00" ); // invalid: < 2 D
|
||||||
doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H
|
doTestDateTimeF( "0001-01-01T0:00:00" ); // invalid: < 2 H
|
||||||
|
@@ -1352,16 +1352,11 @@ bool Converter::convertDateOrDateTime(
|
|||||||
//Negative Number
|
//Negative Number
|
||||||
++nPos;
|
++nPos;
|
||||||
}
|
}
|
||||||
else if (sal_Unicode('+') == string[nPos])
|
|
||||||
{
|
|
||||||
//Positive Number, explicit AD/CE
|
|
||||||
++nPos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 nYear(0);
|
sal_Int32 nYear(0);
|
||||||
{
|
{
|
||||||
// While ISO 8601 specifies years with a minimum of 4 digits, be
|
// While W3C XMLSchema specifies years with a minimum of 4 digits, be
|
||||||
// leninent in what we accept for years < 1000. One digit is acceptable
|
// leninent in what we accept for years < 1000. One digit is acceptable
|
||||||
// if the remainders match.
|
// if the remainders match.
|
||||||
bSuccess = readDateTimeComponent(string, nPos, nYear, 1, false);
|
bSuccess = readDateTimeComponent(string, nPos, nYear, 1, false);
|
||||||
|
Reference in New Issue
Block a user