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


##########
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:
   Ah, so the reason why those debug statements were showing up on that year 
zero test when I tried tracing it was because that test roundtrips, so I drew 
the wrong conclusion there. it also makes sense why when i intentionally set 
the infoset to 0000 for the date it routed to the dateTimeIsSame function for 
validation and never hit the code path. 
   
   Do we want to follow teh XMLGregorianCalendar behavior and simply throw an 
ILLEgalArgumentException here if yInt is 0? I think that should then be casted 
to a TDMLException during unparse? The issue with that is that we cannot really 
unit test these using the standard TDML test cases unless we convert those to 
parse/unparse errors and expect those errors from the tdml?



-- 
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