2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-19 09:40:32 +03:00

fix: pos calc error on month_day mode

This commit is contained in:
yicone
2021-02-09 22:40:21 +08:00
parent c9fc5a97b8
commit cf63e2ea9a
+5 -1
View File
@@ -469,7 +469,11 @@ export default {
mapPositionToTime(xPos) {
let timeDiffFromStart =
(xPos / this.barContainer.width) * this.getTimeCount()
return this.chartStartMoment.clone().add(timeDiffFromStart, this.timeUnit)
if (this.timeUnit === 'days') {
let duration = moment.duration(timeDiffFromStart, 'days')
timeDiffFromStart = duration.asHours()
}
return moment(this.chartStartMoment).add(timeDiffFromStart, 'hours')
},
},
}