ember-model icon indicating copy to clipboard operation
ember-model copied to clipboard

Date modelType deserialization not supported in IE8

Open jdjkelly opened this issue 11 years ago • 3 comments

This bit specifically:

 Ember.Model.dataTypes[Date] = {
   deserialize: function(string) {
     if (!string) { return null; }
     return new Date(string);
   }

IE8 can't parse iso8601 strings this way. One strategy is to polyfill Date.parse() to support it as described here: https://github.com/csnover/js-iso8601/blob/master/iso8601.js

And then the deserializer would become:

 Ember.Model.dataTypes[Date] = {
   deserialize: function(string) {
     if (!string) { return null; }
     return Date.parse(string);
   }

I've done this in a closed source project for my employer. I can submit a PR with the polyfill added (it's MIT licensed) - but I'm not sure that's what we want to do here? Either way, as it stands the Date type isn't supported in IE8 out of box.

jdjkelly avatar Jan 17 '14 16:01 jdjkelly

@kieran

jdjkelly avatar Jan 17 '14 16:01 jdjkelly

Please submit a PR. It looks like @alexspeller perhaps had a solution in #204 that didn't require a polyfill.

ebryn avatar Feb 21 '14 14:02 ebryn

@jdjkelly ping?

ebryn avatar Mar 12 '14 05:03 ebryn