Last Call Comments - Manipulation of Dates

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 UTC