parent
2ead72c552
commit
ab30692021
3 changed files with 40 additions and 6 deletions
18
app/transforms/ccdb-date.js
Normal file
18
app/transforms/ccdb-date.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Transform.extend({
|
||||
deserialize(serialized) {
|
||||
return serialized || '';
|
||||
},
|
||||
|
||||
serialize(date) {
|
||||
if (date !== '') {
|
||||
const day = date.getDate();
|
||||
const month = date.getMonth() + 1;
|
||||
const year = date.getFullYear();
|
||||
return `${year}-${month}-${day}`;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue