fix(gantt): correctly show month and year in gantt chart on safari

Resolves https://github.com/go-vikunja/frontend/issues/59
This commit is contained in:
kolaente 2022-07-08 16:39:21 +02:00
parent f3835d7dfe
commit 40b30079c1
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -16,7 +16,7 @@
class="month" class="month"
v-for="(m, mk) in days[yk]" v-for="(m, mk) in days[yk]"
> >
{{ formatYear(new Date(`${yk}-${parseInt(mk) + 1}-01`)) }} {{ formatMonthAndYear(yk, parseInt(mk) + 1) }}
<div class="days"> <div class="days">
<div <div
:class="{ today: d.toDateString() === now.toDateString() }" :class="{ today: d.toDateString() === now.toDateString() }"
@ -436,7 +436,9 @@ export default defineComponent({
this.newTaskTitle = '' this.newTaskTitle = ''
this.hideCrateNewTask() this.hideCrateNewTask()
}, },
formatYear(date) { formatMonthAndYear(year, month) {
month = month < 10 ? '0' + month : month
const date = new Date(`${year}-${month}-01`)
return this.format(date, 'MMMM, yyyy') return this.format(date, 'MMMM, yyyy')
}, },
}, },