https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2016-02-26T08:38:18ZSaxonica Developer CommunitySaxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=58272016-02-26T08:38:18ZMichael Kaymike@saxonica.com
<ul><li><strong>Category</strong> set to <i>XPath conformance</i></li><li><strong>Assignee</strong> set to <i>Debbie Lockett</i></li></ul><p>I have added this to the QT3 test suite as CastExpr/CastAs676</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=58342016-02-26T17:56:37ZDebbie Lockettdebbie@saxonica.com
<ul><li><strong>Fix Committed on Branch</strong> <i>9.6, 9.7</i> added</li></ul><p>Bug fix committed on 9.6 and 9.7 branches.</p>
<p>Fix in DateTimeValue.makeDateTimeValue: if the microseconds value rounds to the upper bound of 1,000,000, then truncate to 999,999.</p>
<p>(So in QT3 test CastExpr/CastAs676 we now return 9999-12-31T23:59:59.999999)</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=58352016-02-26T17:57:37ZDebbie Lockettdebbie@saxonica.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li></ul> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=58452016-02-28T23:33:56Zstewart mendaystewart.menday@hvccc.com.au
<ul></ul><p>Why is there a limit of 6 digits in the factional part of a second? I thought that the W3 standard was for any number of digits?</p>
<p>The max DateTime value in dot net is 9999-12-31T23:59:59.9999999 (a precision of 100 nanoseconds), if you truncate this to 9999-12-31T23:59:59.999999 (a precision of 1 microsecond) you cannot test for value == DateTime.max.</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=58462016-02-28T23:51:04ZMichael Kaymike@saxonica.com
<ul></ul><p>The W3C specs require support for millisecond precision (3 fractional digits) in xs:dateTime (See Functions and Operators section 9.1.1). Saxon chooses to support microsecond precision (6 digits). I've no particular recollection about why this figure was chosen.</p>
<p>As far as I can see, there's nothing in the specs that says what you should do if casting from a string with more digits than this, but analogy with other data types suggests that rounding is a reasonable strategy. However, when we thought about your edge case, we decided that rounding the milliseconds in such a way that the date changes would not be what users wanted; if they are using a value like this, they almost certainly intend it to mean "the last representable point in time before the next day starts", so truncation is more appropriate. The alternative strategy, of rounding to 10000-01-01T00:00:00 would also create a value that's not equal to .NET's DateTime.max.</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=58472016-02-29T00:06:30Zstewart mendaystewart.menday@hvccc.com.au
<ul></ul><p>Michael</p>
<p>Thanks for you prompt response, the level of support here is second to none, awesome job.</p>
<p>I agree with your reasoning here with regard to truncating as apposed to rounding but given that the native DateTime in dot net uses 100 nanosecond or 7 digit precision it would be best if the dot net (or all) version(s) of Saxon used 7 digits for DateTime values.</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=59102016-03-11T16:43:09ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Applies to branch</strong> <i>9.7</i> added</li></ul> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=59522016-03-11T17:04:35ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Fixed in Maintenance Release</strong> <i>9.7.0.4</i> added</li></ul><p>Bug fix applied in the Saxon 9.7.0.4 maintenance release. Leave open until patched applied in the 9.6 maintenance release.</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=63822016-05-26T08:47:37ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>Fixed in Maintenance Release</strong> <i>9.6.0.9</i> added</li><li><strong>Fixed in Maintenance Release</strong> deleted (<del><i>9.7.0.4</i></del>)</li></ul><p>Bug fix applied in the Saxon 9.6.0.9 maintenance release.</p> Saxon - Bug #2651: select="xs:string(xs:dateTime('9999-12-31T23:59:59.9999999'))" gives => '9999-12-31T23:59:59.:"https://saxonica.plan.io/issues/2651?journal_id=63972016-05-26T08:59:18ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Sprint/Milestone</strong> set to <i>9.7.0.4</i></li><li><strong>Fixed in Maintenance Release</strong> <i>9.7.0.4</i> added</li></ul>