WIP Reimbursements/expenses

This commit is contained in:
2020-09-28 14:13:17 +02:00
parent 4722064337
commit e4d2fdfce4
13 changed files with 271 additions and 168 deletions
-43
View File
@@ -1,43 +0,0 @@
import EmberObject, { computed } from '@ember/object';
import moment from 'moment';
import { A } from '@ember/array';
export default EmberObject.extend({
title: null,
description: null,
currency: null,
amount: null,
date: null,
url: null,
tags: null,
init () {
this._super(...arguments);
this.setDefaultValues();
},
iso8601Date: computed('date', 'time', function() {
return this.time ? `${this.date}T${this.time}` : this.date;
}),
jsDate: computed('iso8601Date', function() {
return moment(this.iso8601Date).toDate();
}),
setDefaultValues () {
this.set('defaultDate', moment().startOf('hour').toDate());
this.setProperties({
title: '',
description: '',
currency: 'EUR',
amount: 0,
date: this.defaultDate,
url: null,
tags: A([])
});
},
serialize () {
return JSON.stringify(this);
}
});