1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-13 20:58:16 +03:00

Fix xmlSchemaGetCanonValue formatting for date and dateTime

Per https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation,
the date portion is supposed to use '-' as the delimiter
This commit is contained in:
Kevin Puetz 2020-01-31 13:16:37 -06:00 committed by Nick Wellnhofer
parent c7c526d6d0
commit e45e06de90

View File

@ -6003,13 +6003,13 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue)
* recoverable timezone and not "Z".
*/
snprintf(buf, 30,
"%04ld:%02u:%02uZ",
"%04ld-%02u-%02uZ",
norm->value.date.year, norm->value.date.mon,
norm->value.date.day);
xmlSchemaFreeValue(norm);
} else {
snprintf(buf, 30,
"%04ld:%02u:%02u",
"%04ld-%02u-%02u",
val->value.date.year, val->value.date.mon,
val->value.date.day);
}
@ -6030,14 +6030,14 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue)
* TODO: Check if "%.14g" is portable.
*/
snprintf(buf, 50,
"%04ld:%02u:%02uT%02u:%02u:%02.14gZ",
"%04ld-%02u-%02uT%02u:%02u:%02.14gZ",
norm->value.date.year, norm->value.date.mon,
norm->value.date.day, norm->value.date.hour,
norm->value.date.min, norm->value.date.sec);
xmlSchemaFreeValue(norm);
} else {
snprintf(buf, 50,
"%04ld:%02u:%02uT%02u:%02u:%02.14g",
"%04ld-%02u-%02uT%02u:%02u:%02.14g",
val->value.date.year, val->value.date.mon,
val->value.date.day, val->value.date.hour,
val->value.date.min, val->value.date.sec);