You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "Robert Marcano (Jira)" <ji...@apache.org> on 2022/01/06 16:26:00 UTC

[jira] [Created] (XMLBEANS-588) GDate can return diferent values on different current timezones

Robert Marcano created XMLBEANS-588:
---------------------------------------

             Summary: GDate can return diferent values on different current timezones
                 Key: XMLBEANS-588
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-588
             Project: XMLBeans
          Issue Type: Bug
            Reporter: Robert Marcano


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



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org