getodk / xforms-spec

The XForms-derived specification used in the ODK ecosystem. If you are interested in building a tool that is compliant with the forms rendered by ODK tools, this is the place to start. ✨⚒✨
https://getodk.github.io/xforms-spec/
30 stars 26 forks source link

clarified dates, dateTimes, today(), and now(), closes #56 #218

Closed MartijnR closed 5 years ago

MartijnR commented 5 years ago

Hi @ggalmazor,

Does this sufficiently and clearly document the date, dateTime, time, datatypes and today() and now()?

P.S. I snuck in the missing +, - operators. Sorry about that.

MartijnR commented 5 years ago

Thank you!

Internally an XPath Evaluator will call the number() function to cast operands and function parameters to a number when required. It does this e.g. when + is used as in '2' + 1 is evaluated behind-the-scenes via number('2') + 1.

I tried to define the ODK behavior with date comparisons . < today() and date arithmetic today() + 1 in the same manner (even though we may use all kinds of wizardry in JavaRosa and Enketo implementations), to make it consistent with native arithmetic and comparisons.