SWI-Prolog / packages-sgml

The SWI-Prolog SGML/XML/HTML parser
4 stars 10 forks source link

Possibly incorrect XSD dateTime conversion #21

Open wouterbeek opened 6 years ago

wouterbeek commented 6 years ago

Negative years seems to be off by one:

?- rdf_equal(xsd:dateTime, Type), xsd_time_string(DateTime, Type, '-2999-01-01T00:00:00Z').
Type = 'http://www.w3.org/2001/XMLSchema#dateTime',
DateTime = date_time(-3000, 1, 1, 0, 0, 0, 0).

Negative years that consist of more than four digits are not parsed:

?- rdf_equal(xsd:dateTime, Type), xsd_time_string(DateTime, Type, '-222999-12-01T00:00:
ERROR: Syntax error: xsd_time
JanWielemaker commented 6 years ago

Pushed a patch for years with more than 4 digits. That seems clear. If I read https://www.w3.org/TR/xmlschema-2/#dateTime though, 0000 seems to be the year 1BC. Not sure how to interpret all this though.