[
Lists Home |
Date Index |
Thread Index
]
Hi Jeff,
> Yes, the comparison of these durations is determinate. However, it
> is inconsistent with
>
> 2004-02-29 + P1Y1D > 2004-02-29 + P365D
>
> which is false according to the algorithm you described, (but would
> be true for any starting date which is not 02-29 in a leap year). In
> other words, I cannot deduce from x > y (P1Y1D > P365D) that a + x >
> a + y. I realize its a different > operator (for durations vs.
> dates), but if they are not defined consistently there is a problem.
Ah, I see what you mean. It's not just a problem with xs:durations,
though, rather a problem whenever there's "pinning" of the dates back
to valid values. For example, even if you're just looking at
xf:yearMonthDurations, you'd expect:
(2002-08-31 + P1M) + P1M
to be equal to:
2002-08-31 + (P1M + P1M)
but (according to the algorithm in the Datatypes Rec.):
(2002-08-31 + P1M) + P1M => 2002-09-30 + P1M => 2002-10-30
whereas:
2002-08-31 + (P1M + P1M) => 2002-08-31 + P2M => 2002-10-31
I don't know whether XQuery & XPath 2.0 are supposed to use the W3C
XML Schema algorithm or not. The F&O WD just says:
op:add-yearMonthDuration-to-dateTime(dateTime $srcval1,
yearMonthDuration $srcval2) => dateTime
Returns the end of a time period by adding a yearMonthDuration
($srcval2) to the dateTime that starts the period ($srcval1). If the
duration is negative, then the "end" of the period precedes the
"start" of the period.
Well spotted. I'll raise it as an issue.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
|