Add time input to contribution form #146

Merged
raucao merged 4 commits from feauture/141-time_picker into master 2019-08-12 12:52:08 +00:00
Showing only changes of commit d8f565cd9e - Show all commits
+1 -1
View File
@@ -21,7 +21,7 @@ export default Component.extend({
raucao commented 2019-07-31 12:25:16 +00:00 (Migrated from github.com)
Review

Someone has an idea for how to do this in the most simple and efficient way? /cc @galfert @fsmanuel

Someone has an idea for how to do this in the most simple and efficient way? /cc @galfert @fsmanuel
galfert commented 2019-07-31 14:19:04 +00:00 (Migrated from github.com)
Review

I think it works like this:

    const defaultDate = new Date();
    defaultDate.setHours(0, 0, 0, 0);
    this.set('defaultDate', defaultDate);

Unfortunately you can't just concatenate it (new Date().setHours(0, 0, 0, 0)), because setHours returns a timestamp.

I think it works like this: ```suggestion const defaultDate = new Date(); defaultDate.setHours(0, 0, 0, 0); this.set('defaultDate', defaultDate); ``` Unfortunately you can't just concatenate it (`new Date().setHours(0, 0, 0, 0)`), because `setHours` returns a timestamp.
galfert commented 2019-07-31 14:26:34 +00:00 (Migrated from github.com)
Review

Scrap my previous comment, I misread you wanted it to be the beginning of the day, not the current hour.

Since we already have moment in the project, I think the easiest way would be

    this.set('defaultDate', moment().startOf('hour').toDate());
Scrap my previous comment, I misread you wanted it to be the beginning of the day, not the current hour. Since we already have moment in the project, I think the easiest way would be ```suggestion this.set('defaultDate', moment().startOf('hour').toDate()); ```
raucao commented 2019-07-31 16:26:28 +00:00 (Migrated from github.com)
Review

Awesome, will try that. Thanks!

Awesome, will try that. Thanks!
init () {
this._super(...arguments);
this.set('defaultDate', new Date()); // TODO use beginning of current hour
this.set('defaultDate', moment().startOf('hour').toDate());
// Default attributes used by reset
this.set('attributes', {