W3C home > Mailing lists > Public > public-forms@w3.org > September 2007

Ugliness of dateTime math

From: John Boyer <boyerj@ca.ibm.com>
Date: Tue, 25 Sep 2007 17:49:37 -0700
To: Forms WG (new) <public-forms@w3.org>
Cc: www-forms-editor@w3.org
Message-ID: <OF36B4D8AD.01BF6D71-ON88257362.0002CA5E-88257362.00049059@ca.ibm.com>
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:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 October 2013 22:06:45 UTC