This project is read-only.
1

Closed

Missing T in DateTime serialized string

description

Hi,

I don't know if this is by design, but when you serialize DateTime the output is like:
2014-12-21 00:00:00
I wonder why you don't generate: 2014-12-21T00:00:00 (with T between - ISO).
In this way you can easily create new Date(...) inside JavaScript.

I looked thru your code and in fact you are explicitly adding ' ' instead of 'T'.

Thanks,
Closed Jul 15, 2016 at 3:09 PM by MGholam

comments

MGholam wrote Nov 22, 2014 at 5:24 AM

Most if not all the deserializer don't care and ignore that position (the space is more human readable) but you are right to be strictly compliant there has to be a 'T' there :)

Thanks!

kheim wrote Nov 22, 2014 at 10:36 AM

Thanks for the quick response.

It's not that much about deserializing - everything works ok with or without T.

It's more about being able to pass directly this string to Date object in JavaScript:
var date = new Date("2014-12-21 00:00:00") => invalid date format
var date = new Date("2014-12-21T00:00:00") => ok

Thanks for great job - love this serializer.

MGholam wrote Nov 25, 2014 at 6:40 AM

I was not aware of this, I will look into it.

MGholam wrote Nov 25, 2014 at 10:51 AM

The invalid date works in chrome, not in IE or firefox.

kheim wrote Nov 25, 2014 at 12:03 PM

ok, but 2014-12-21T00:00:00 works everywhere, so I think it's better to use T.
:)