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

String handling with Dates

Open ahacking opened this issue 11 years ago • 0 comments

Currently I am working around an issue with Date/string handling as follows:

Em.Model.dataTypes[Date].serialize = function(date) {
  if (!date) {
    return null;
  }
  if (Em.typeOf(date) === 'string') {
    date = new Date(date);
  }
  return date.toISOString();
};

This may be similar/related to the number strings issue #347.

ahacking avatar Jul 12 '14 11:07 ahacking