BUG: Use datepicker in collection form (#81)

Fixes #73
This commit is contained in:
Matthew Ryan Dillon 2018-03-13 07:59:49 -07:00 committed by GitHub
parent 2ead72c552
commit ab30692021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 6 deletions

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