Created
April 16, 2016 22:18
-
-
Save GRardB/4d3edfaec64c69c794dcfc61aa590044 to your computer and use it in GitHub Desktop.
This file contains 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
// app/transforms/utc.js | |
import moment from 'moment'; | |
import Transform from 'ember-data/transform'; | |
export default Transform.extend({ | |
deserialize(serialized) { | |
const date = serialized.split('T')[0]; | |
return moment(date).toDate(); | |
}, | |
serialize(deserialized) { | |
const date = moment(deserialized).format('YYYY-MM-DD'); | |
return moment.utc(date).toDate(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment