W3C home > Mailing lists > Public > www-forms-editor@w3.org > February 2002

Last Call Comments - Manipulation of Dates

From: Tom Keane <tkeane@cardiff.com>
Date: Fri, 22 Feb 2002 16:02:20 -0800
Message-ID: <E840F0B7E6189547BDB91DA8BF2228AB3BE5B0@csmail.cardiff.com>
To: "'www-forms-editor@w3.org'" <www-forms-editor@w3.org>
XForms uses XPath for its underlying expression model and XML Schema for its
data typing. However, the current version of XPath doesn't understand XML
Schema data types (I've heard that XPath 2.0 will...).

It is very common on forms to want to manipulate dates and times. Examples
appear in validations (e.g. a date is valid if it is within 7 days of the
current date) and calculations (e.g. on a time card summing the number of
hours worked).

XForms needs to address this and make it easy for users to perform such
calculations.

I see two paths:
1. Add functions to the XPath core library to allow dates and times to be
converted to/from some numeric format.
2. Add functions to the XPath core library to perform calculations on
date/times/durations.

For example:
compareDate( d1, d2 );    // returns: -1 if d1 < d2, 0 if d1 == d2, 1 if d1
> d2
addToDate( date, duration ); // adds duration to date and returns the result
as a date
dateDuration(start, end); // calculates end - start and returns as a
duration.

similar functions would be needed for date-times and times.

Also, it would be very useful to specify exactly what the results are of
adding a duration to a date if when the duration specifies a month:  i.e.
"2000-2-1" + "P1M" == ??? (is it date + 30 days or is it "2000-3-1")


Tom Keane
Director, Core Technologies
CARDIFF, Inc.
www.cardiff.com <http://www.cardiff.com> 
tkeane@cardiff.com <mailto:tkeane@cardiff.com> 
Received on Friday, 22 February 2002 19:05:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 10 June 2009 18:12:10 GMT