Fix gantt months being wrong
This commit is contained in:
parent
f4c552a79f
commit
388a31d95a
1 changed files with 5 additions and 12 deletions
|
@ -25,17 +25,12 @@
|
||||||
v-for="(m, mk) in days[yk]"
|
v-for="(m, mk) in days[yk]"
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
new Date(
|
new Date(new Date(`${yk}-${parseInt(mk) + 1}-01`)).toLocaleString('en-us', {month: 'long'})
|
||||||
new Date(yk).setMonth(mk)
|
|
||||||
).toLocaleString('en-us', {month: 'long'})
|
|
||||||
}},
|
}},
|
||||||
{{ new Date(yk).getFullYear() }}
|
{{ new Date(yk).getFullYear() }}
|
||||||
<div class="days">
|
<div class="days">
|
||||||
<div
|
<div
|
||||||
:class="{
|
:class="{ today: d.toDateString() === now.toDateString() }"
|
||||||
today:
|
|
||||||
d.toDateString() === now.toDateString(),
|
|
||||||
}"
|
|
||||||
:key="dk + 'day'"
|
:key="dk + 'day'"
|
||||||
:style="{ width: dayWidth + 'px' }"
|
:style="{ width: dayWidth + 'px' }"
|
||||||
class="day"
|
class="day"
|
||||||
|
@ -289,9 +284,7 @@ export default {
|
||||||
this.startDate = new Date(this.dateFrom)
|
this.startDate = new Date(this.dateFrom)
|
||||||
this.endDate = new Date(this.dateTo)
|
this.endDate = new Date(this.dateTo)
|
||||||
|
|
||||||
this.dayOffsetUntilToday =
|
this.dayOffsetUntilToday = Math.floor((this.now - this.startDate) / 1000 / 60 / 60 / 24) + 1
|
||||||
Math.floor((this.now - this.startDate) / 1000 / 60 / 60 / 24) +
|
|
||||||
1
|
|
||||||
},
|
},
|
||||||
prepareGanttDays() {
|
prepareGanttDays() {
|
||||||
// Layout: years => [months => [days]]
|
// Layout: years => [months => [days]]
|
||||||
|
@ -306,14 +299,14 @@ export default {
|
||||||
years[date.getFullYear() + ''] = {}
|
years[date.getFullYear() + ''] = {}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
years[date.getFullYear() + ''][date.getMonth() + ''] ===
|
years[date.getFullYear() + ''][date.getMonth() + ''] === undefined
|
||||||
undefined
|
|
||||||
) {
|
) {
|
||||||
years[date.getFullYear() + ''][date.getMonth() + ''] = []
|
years[date.getFullYear() + ''][date.getMonth() + ''] = []
|
||||||
}
|
}
|
||||||
years[date.getFullYear() + ''][date.getMonth() + ''].push(date)
|
years[date.getFullYear() + ''][date.getMonth() + ''].push(date)
|
||||||
this.fullWidth += this.dayWidth
|
this.fullWidth += this.dayWidth
|
||||||
}
|
}
|
||||||
|
console.log(years)
|
||||||
this.$set(this, 'days', years)
|
this.$set(this, 'days', years)
|
||||||
},
|
},
|
||||||
parseTasks() {
|
parseTasks() {
|
||||||
|
|
Loading…
Reference in a new issue