Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
When using Saxon XPath processor in order to retrieve a date value for example:
XmlObject o = XmlObject.Factory.parse("<a/>");
XmlObject[] res = o.selectPath("xs:date(\"2000-01-01\")");
GDate gdate = ((XmlDate) res[0]).getGDateValue();
assertEquals(gdate.getYear(), 2000);
fails is the current timezone has a negative offset, for example US/Eastern.
The problem arises because SaxonXPath uses internally a method that returns java.util.Date instances and those always has a timezone attached. Maybe the GDate should not come from a Date resulting from the invocation of SequenceTool.convertToJava() in SaxonXPath
GDate should contain the exact date without timezone problems, it could probably should not be instantiated from a Date coming from Saxon, but from the native Saxon Date representation