Display of null dates in Web Services

For questions and postings not covered by the other forums
mike.day
Posts: 10
Joined: Tue Oct 01, 2013 8:19 am

Display of null dates in Web Services

Postby mike.day » Thu Jan 09, 2014 1:04 pm

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)?

murray
Posts: 144
Joined: Fri Aug 14, 2009 6:58 pm
Location: New Plymouth, New Zealand

Re: Display of null dates in Web Services

Postby murray » Thu Jan 09, 2014 6:18 pm

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.
Murray (N.Z.)

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Display of null dates in Web Services

Postby ghosttie » Fri Jan 10, 2014 2:11 am

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
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Display of null dates in Web Services

Postby ghosttie » Fri Jan 10, 2014 3:58 am

Or you could add a boolean param to specify whether the date param is null
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

M45HY
Posts: 63
Joined: Wed Jul 11, 2012 7:32 am
Location: Mansfield, Nottinghamshire, UK

Re: Display of null dates in Web Services

Postby M45HY » Wed Jan 15, 2014 1:54 am

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(?)
"If you can't explain it simply, you don't understand it well enough." - Albert Einstein


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 20 guests

cron