Skip to content

Commit

Permalink
fix(DateSelection): Value as date
Browse files Browse the repository at this point in the history
  • Loading branch information
reinzor committed Dec 7, 2020
1 parent fb7c791 commit 755e14c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/DataSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
<label class="sr-only" for="from-date">From</label>
<b-form-datepicker id="from-date" class="mb-2 mr-sm-2 mb-sm-0"
@input="fetchData()"
:value-as-date="true"
v-model="from"
:hide-header="true">
</b-form-datepicker>
<label class="sr-only" for="to-date">To</label>
<b-form-datepicker id="to-date" class="mb-2 mr-sm-2 mb-sm-0"
@input="fetchData()"
:disabled="type != Types.RANGE"
:value-as-date="true"
v-model="to"
:hide-header="true">
</b-form-datepicker>
Expand Down Expand Up @@ -48,25 +50,25 @@ export default {
fromDate() {
switch (this.type) {
case Types.DAY:
return this.from;
return new Date(this.from)
case Types.WEEK:
return this.getFirstDayOfWeek();
case Types.MONTH:
return this.getFirstDayOfMonth();
case Types.RANGE:
return this.from;
return new Date(this.from)
}
},
toDate() {
switch (this.type) {
case Types.DAY:
return this.from;
return new Date(this.from)
case Types.WEEK:
return this.getLastDayOfWeek();
case Types.MONTH:
return this.getLastDayOfMonth();
case Types.RANGE:
return this.to;
return new Date(this.to)
}
},
},
Expand Down

0 comments on commit 755e14c

Please sign in to comment.