Page 1 of 1
Display of null dates in Web Services
Posted: Thu Jan 09, 2014 1:04 pm
by mike.day
Null dates (Date data type) are being outputted as "1900-01-01" in our Jade Web Service. Does anyone know how to force these null dates to return "" (blank)?
Re: Display of null dates in Web Services
Posted: Thu Jan 09, 2014 6:18 pm
by murray
I think you will find that the problem is that a Date type, as defined in the XML data schema, must have a year, month and day, and so cannot be null. The Jade types are mapped directly to the XML data types (as per W3C XSD specifications).
A non-ideal "solution" I have seen in the past is to simply redfine the field as a String, which must be converted and parsed separately.
Re: Display of null dates in Web Services
Posted: Fri Jan 10, 2014 2:11 am
by ghosttie
Or you could assume that the date "1900-01-01" will never legitimately be used by your application and add some code to the WS client to replace those dates with null
Re: Display of null dates in Web Services
Posted: Fri Jan 10, 2014 3:58 am
by ghosttie
Or you could add a boolean param to specify whether the date param is null
Re: Display of null dates in Web Services
Posted: Wed Jan 15, 2014 1:54 am
by M45HY
Hi Mike,
When the system is about to output the date to a certain text field on the browser, surely it would have to convert it into a text format. As soon as it's done this (or possibly even before) is it not possible to have some sort of web validation to say e.g. if the date is equal to 1900-01-01 then leave the date field blank? I know this isn't the best way and could be classified as a "cheat" but it could relieve you of the problem in the short term(?)