Ugliness of dateTime math

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

[1] 
http://www.w3.org/MarkUp/Forms/specs/XForms1.1/index-diff.html#fn-local-date

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]

[2] 
http://www.w3.org/MarkUp/Forms/specs/XForms1.1/index-diff.html#fn-local-dateTime

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].

Cheers,
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
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer

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