Search code examples
orbeonxforms

Orbeon form builder: Using date fields with initial value "current-date()"


I am using date fields in Orbeon form builder that should be prefilled with the current date (see http://i42.tinypic.com/erdjrb.jpg). When choosing a date by hand in the form, the date format in resulting XML model is set to "2011-07-12". But when not changing the default value of current-date(), then I get "2011-07-12+02:00". Does anybody know why the date format is different when I prefill it with current-date()?

Thank you!


Solution

  • The XPath function fn:current-date() by definition returns the date together with explicit time zone information. I assume orbeon just passes the function call to the XPath engine (Saxon i think). A quick workaround would be to format the result of current-date() using format-date(), for example:

    format-date(current-date(), '[Y]-[M01]-[D01]')
    

    Since i don't use Form Builder, i can't tell in detail, but i assume setting the config options how to format xforms:input controls regarding date and time values applies for form builder, too.