Created
August 19, 2014 15:46
-
-
Save cspanring/c25b91fa7d64a24521a4 to your computer and use it in GitHub Desktop.
Ember Data Isodate Transform (requires moment.js)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import DS from 'ember-data'; | |
| export default DS.Transform.extend({ | |
| deserialize: function(serialized) { | |
| if (serialized) { | |
| return moment(serialized).toDate(); | |
| } | |
| return serialized; | |
| }, | |
| serialize: function(deserialized) { | |
| if (deserialized) { | |
| return moment(deserialized).format('YYYY-MM-DD'); | |
| } | |
| return deserialized; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment