gdesrosiers1805 commented on code in PR #1685:
URL: https://github.com/apache/daffodil/pull/1685#discussion_r3436481844


##########
daffodil-core/src/main/scala/org/apache/daffodil/lib/calendar/DFDLCalendarConversion.scala:
##########
@@ -95,7 +98,16 @@ object DFDLCalendarConversion {
     val d = string.substring(endYear + 4, endYear + 6)
 
     try {
-      calendar.set(Calendar.EXTENDED_YEAR, Integer.parseInt(y))
+      // Use YEAR + ERA rather than EXTENDED_YEAR to match XSD 1.0 numbering:
+      // a negative lexical year is BCE, stored as ERA=BC with positive YEAR.
+      val yInt = Integer.parseInt(y)
+      if (yInt < 0) {

Review Comment:
   ok great! the last question I have about this for the parse side that gets 
routed to the XMLGregorianCalendar and that exception does not become a 
parseError, the TDMLRunner simply throws a TDMLException. Are we ok with that 
behavior? we don't have a test case for that in the form of TDML because of 
that reason. we could unit test the function itself to show that it throws an 
exception for year zero assuming the exception being thrown here is an 
acceptable behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to