Closed manuelmitasch closed 10 years ago
Can you add a failing test?
As the transform code is borrowed from Ember Date this should also be an issue there. This seems related even thought outdated due to the transform rewrite: https://github.com/emberjs/data/pull/258
I believe it should be possible to use the date attribute without creating a Date object in a view.
Just wrote my first lines of coffeescript and mocha for the test ;)
I have drastically overhauled the serialization layer in epf and this pull request no longer merges cleanly. In my opinion, however, this PR should not be merged. The serialize
method should only take valid values returned by deserialize
. In this case, deserialize always returns date objects.
Thanks for the PR though! One solution to your use case would be to create a custom "date string" serializer that deals with strings.
Previously the date transform serialize method excepted a Date object only. This resulted in a null value in the payload if a new record was saved (session.flush).
With this commit it tries to create a new Date object if a string or number are passed. Thus, serialization of newly created date properties should work now.