Ugliness of dateTime math

Have a quick look at the example I added to the spec of adding 31 days to 
"today" [1]


It has pretty much the level of simplicity I had hoped we could get to in 
1.1.  Sure it could be even easier, but hey that's XPath 2.0 and hence 
XForms 2.0.  But it is a relatively simple one-line calculation.

I had rather thought it would shake out much the same way for dateTime. 
I.e. I think it should be roughly the same level of ease to say "calculate 
2 hours to now".

Now look at the example I added to local-dateTime() [2]


It can be done, but just barely.  It is bad enough that I put it as an 
example in the spec in the hope that it would shame us into fixing the 
problem.  It seems to me that we need only provide some optional parameter 
to the seconds-to/from-dateTime() to get the infernal things to stop 
converting to UTC.

Suppose we had an optional boolean parameter defaulting to true that said 
'useUTC'.  It would default to true for backwards compatibility, but if we 
had the optional parameter and set it to false, then I think the example 
in [2] would reduce to:

seconds-to-dateTime(seconds-from-dateTime(local-dateTime(), false()) + 
7200, false())

Perhaps a touch noiser than just adding to a date, but it is so very much 
more like the example in [1].

John M. Boyer, Ph.D.
STSM: Lotus Forms Architect and Researcher
Chair, W3C Forms Working Group
Workplace, Portal and Collaboration Software
IBM Victoria Software Lab


Received on Wednesday, 26 September 2007 00:49:54 UTC