Project

Profile

Help

Bug in fn:adjust-dateTime-to-timezone?

Added by Joe Wicentowski almost 7 years ago

In oXygen 19.0 with Saxon EE 9.7.0.15, evaluating the following two expressions, which differ only in their positive vs. negative timezone offset, return the same result:

  1. adjust-dateTime-to-timezone(xs:dateTime("1865-08-21T00:00:00+00:25"), xs:dayTimeDuration("PT0H"))
  2. adjust-dateTime-to-timezone(xs:dateTime("1865-08-21T00:00:00-00:25"), xs:dayTimeDuration("PT0H"))

The result in either case is:

1865-08-20T23:35:00Z

This is the correct result for the first expression, but the second expression should return the following:

1865-08-21T00:25:00Z

timeanddate.com has time zone adjustments back to 1800. Some examples: Berlin, 1850 — 1892: UTC +0:53:28 Dublin, 1850 — 1879: UTC -0:25 Lisbon, 1850 — 1899: UTC -0:36:45 Paris, 1850 — 1890: UTC +0:09:21 Stockholm, 1850 — 1878: UTC +1:12:12

The 1865 date above applies the relevant offset for Dublin during the period 1850 — 1899.

eXist and BaseX return the expected results in both cases.


Replies (2)

RE: Bug in fn:adjust-dateTime-to-timezone? - Added by Michael Kay almost 7 years ago

Thanks for spotting it. Logged here: https://saxonica.plan.io/issues/3360

Amazing how such bugs can lie dormant for years. (The code is taking tz= tzhours60signum, and then adds or subtracts tzminutes depending on whether tz<0. Which is clearly wrong!)

There are two versions of the code, one for xs:dateTime and one for all the other chrono types; only the xs:dateTime version has the bug.

RE: Bug in fn:adjust-dateTime-to-timezone? - Added by Joe Wicentowski almost 7 years ago

Many thanks, Michael. I'll take it as a badge of honor that our project surfaced such a rare bug in Saxon. Please let me know if there's anything I can do to help,

    (1-2/2)

    Please register to reply