2020-01-16 20:01:12 +03:00
|
|
|
import Transform from '@ember-data/serializer/transform';
|
2022-09-23 20:15:08 +03:00
|
|
|
import moment from 'moment-timezone';
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2022-02-02 13:40:43 +03:00
|
|
|
export default class MomentDate extends Transform {
|
2015-10-28 14:36:45 +03:00
|
|
|
deserialize(serialized) {
|
2014-06-05 20:04:59 +04:00
|
|
|
if (serialized) {
|
|
|
|
return moment(serialized);
|
|
|
|
}
|
|
|
|
return serialized;
|
2022-02-02 13:40:43 +03:00
|
|
|
}
|
2015-10-28 14:36:45 +03:00
|
|
|
|
|
|
|
serialize(deserialized) {
|
2014-06-05 20:04:59 +04:00
|
|
|
if (deserialized) {
|
|
|
|
return moment(deserialized).toDate();
|
|
|
|
}
|
|
|
|
return deserialized;
|
|
|
|
}
|
2022-02-02 13:40:43 +03:00
|
|
|
}
|