Add time input to conribution form

After adding it as a separate field, I figured out that we should use
the same picker, because otherwise we'd have to keep the date in sync
depending on the time zone. Zones are too messy in that regard, and the
date is already normalized to UTC before creating the contribution
record.

closes #141
This commit is contained in:
2019-07-31 13:20:39 +02:00
parent aa9c3648c0
commit a9480a09f1
3 changed files with 72 additions and 54 deletions
+4 -4
View File
@@ -21,13 +21,13 @@ export default Component.extend({
init () {
this._super(...arguments);
this.set('defaultDate', new Date());
this.set('defaultDate', new Date()); // TODO use beginning of current hour
// Default attributes used by reset
this.set('attributes', {
contributorId: null,
kind: null,
date: [new Date()],
date: this.defaultDate,
amount: null,
description: null,
url: null,
@@ -49,8 +49,8 @@ export default Component.extend({
}
const attributes = this.getProperties(Object.keys(this.attributes));
const [ date/* , time */ ] = attributes.date[0].toISOString().split('T');
attributes.date = date;
const [ date, time ] = attributes.date[0].toISOString().split('T');
[ attributes.date, attributes.time ] = [ date, time ];
this.set('inProgress', true);