1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/transforms/moment-utc.js

22 lines
514 B
JavaScript

import Transform from '@ember-data/serializer/transform';
import moment from 'moment';
export default Transform.extend({
deserialize(serialized) {
if (serialized) {
return moment.utc(serialized);
}
return serialized;
},
serialize(deserialized) {
if (deserialized) {
try {
return deserialized.toJSON();
} catch (e) {
return deserialized;
}
}
return deserialized;
}
});