fix: dates broken in dst
This commit is contained in:
parent
097d69ce90
commit
d5ee5a4e45
12
src/bar.js
12
src/bar.js
@ -485,17 +485,7 @@ export default class Bar {
|
|||||||
x_in_units * this.gantt.config.step,
|
x_in_units * this.gantt.config.step,
|
||||||
this.gantt.config.unit,
|
this.gantt.config.unit,
|
||||||
);
|
);
|
||||||
const start_offset =
|
console.log(date_utils.diff(new_start_date, this.gantt.gantt_start));
|
||||||
this.gantt.gantt_start.getTimezoneOffset() -
|
|
||||||
new_start_date.getTimezoneOffset();
|
|
||||||
|
|
||||||
if (start_offset) {
|
|
||||||
new_start_date = date_utils.add(
|
|
||||||
new_start_date,
|
|
||||||
start_offset,
|
|
||||||
'minute',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const width_in_units = bar.getWidth() / this.gantt.config.column_width;
|
const width_in_units = bar.getWidth() / this.gantt.config.column_width;
|
||||||
const new_end_date = date_utils.add(
|
const new_end_date = date_utils.add(
|
||||||
|
|||||||
@ -125,7 +125,10 @@ export default {
|
|||||||
diff(date_a, date_b, scale = 'day') {
|
diff(date_a, date_b, scale = 'day') {
|
||||||
let milliseconds, seconds, hours, minutes, days, months, years;
|
let milliseconds, seconds, hours, minutes, days, months, years;
|
||||||
|
|
||||||
milliseconds = date_a - date_b;
|
milliseconds =
|
||||||
|
date_a -
|
||||||
|
date_b +
|
||||||
|
(date_b.getTimezoneOffset() - date_a.getTimezoneOffset()) * 60000;
|
||||||
seconds = milliseconds / 1000;
|
seconds = milliseconds / 1000;
|
||||||
minutes = seconds / 60;
|
minutes = seconds / 60;
|
||||||
hours = minutes / 60;
|
hours = minutes / 60;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user