mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
850a223dd4
refs https://github.com/TryGhost/Admin/pull/2242 - there was no further EmberObject specific usage to migrate for these classes so the @classic decorator is not necessary
19 lines
434 B
JavaScript
19 lines
434 B
JavaScript
import Transform from '@ember-data/serializer/transform';
|
|
import moment from 'moment';
|
|
|
|
export default class MomentDate extends Transform {
|
|
deserialize(serialized) {
|
|
if (serialized) {
|
|
return moment(serialized);
|
|
}
|
|
return serialized;
|
|
}
|
|
|
|
serialize(deserialized) {
|
|
if (deserialized) {
|
|
return moment(deserialized).toDate();
|
|
}
|
|
return deserialized;
|
|
}
|
|
}
|