Re: Recommended Way To Handle Non-ISO Date Formats
Posted by Kaex on
URL: https://discuss.orbeon.com/Recommended-Way-To-Handle-Non-ISO-Date-Formats-tp4410775p4410788.html
Oops, typo in the above code, it should be:
<xforms:bind id="applicant-dob-bind" nodeset="instance('iso-dates')/dob"
type="xforms:date"
constraint="if(. != '')
then
(xs:date(.) le current-date())
else
true()"
xxforms:default="if (string-length(instance('fr-form-instance')/dob) gt 0)
then
(xs:date(.....Nasty substring code to change to ISO format.....))
else
xxforms:get-request-attribute('applicantDob', 'text/plain')"/>
<xforms:bind nodeset="PersonalDetails/DateOfBirth"
calculate="format-date(instance('iso-dates')/dob, '[M01]/[D01]/[Y]')" />
I should also mention that the above is giving me an "Invalid date "04/13/2011" (When year exceeds 4 digits, leading zeroes are not allowed) (org.orbeon.saxon.type.ValidationException)" error when the value is changed.