mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
d3d626515d
Closes #2888 -Added moment-date `DS.Transform` -`models/post` and `models/user` both use `DS.attr('moment-date')` in place of `date` now.
17 lines
404 B
JavaScript
17 lines
404 B
JavaScript
/* global moment */
|
|
var MomentDate = DS.Transform.extend({
|
|
deserialize: function (serialized) {
|
|
if (serialized) {
|
|
return moment(serialized);
|
|
}
|
|
return serialized;
|
|
},
|
|
serialize: function (deserialized) {
|
|
if (deserialized) {
|
|
return moment(deserialized).toDate();
|
|
}
|
|
return deserialized;
|
|
}
|
|
});
|
|
export default MomentDate;
|