Ghost/ghost/admin/app/transforms/moment-utc.js

23 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;
}
});