fix: bug in half day view
This commit is contained in:
parent
b42a63c547
commit
4c09eccef5
18
src/index.js
18
src/index.js
@ -260,6 +260,7 @@ export default class Gantt {
|
|||||||
this.gantt_end = task._end;
|
this.gantt_end = task._end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('i', this.gantt_start)
|
||||||
let gantt_start, gantt_end;
|
let gantt_start, gantt_end;
|
||||||
if (!this.gantt_start) gantt_start = new Date();
|
if (!this.gantt_start) gantt_start = new Date();
|
||||||
else gantt_start = date_utils.start_of(this.gantt_start, "day");
|
else gantt_start = date_utils.start_of(this.gantt_start, "day");
|
||||||
@ -276,8 +277,7 @@ export default class Gantt {
|
|||||||
const [padding_start, padding_end] = this.options.view_mode_padding[
|
const [padding_start, padding_end] = this.options.view_mode_padding[
|
||||||
viewKey
|
viewKey
|
||||||
].map(date_utils.parse_duration);
|
].map(date_utils.parse_duration);
|
||||||
|
gantt_start = date_utils.add(
|
||||||
this.gantt_start = date_utils.add(
|
|
||||||
gantt_start,
|
gantt_start,
|
||||||
-padding_start.duration,
|
-padding_start.duration,
|
||||||
padding_start.scale,
|
padding_start.scale,
|
||||||
@ -293,13 +293,10 @@ export default class Gantt {
|
|||||||
} else {
|
} else {
|
||||||
format_string = "YYYY-MM-DD HH"
|
format_string = "YYYY-MM-DD HH"
|
||||||
}
|
}
|
||||||
|
this.gantt_start = date_utils.parse(date_utils.format(
|
||||||
this.gantt_start = new Date(
|
date_utils.add(gantt_start, -padding_end.duration, padding_end.scale),
|
||||||
date_utils.format(
|
format_string
|
||||||
date_utils.add(gantt_start, -padding_end.duration, padding_end.scale),
|
));
|
||||||
format_string
|
|
||||||
)
|
|
||||||
);
|
|
||||||
this.gantt_start.setHours(0, 0, 0, 0)
|
this.gantt_start.setHours(0, 0, 0, 0)
|
||||||
|
|
||||||
this.gantt_end = date_utils.add(
|
this.gantt_end = date_utils.add(
|
||||||
@ -315,6 +312,7 @@ export default class Gantt {
|
|||||||
|
|
||||||
while (cur_date === null || cur_date < this.gantt_end) {
|
while (cur_date === null || cur_date < this.gantt_end) {
|
||||||
if (!cur_date) {
|
if (!cur_date) {
|
||||||
|
console.log(this.gantt_start)
|
||||||
cur_date = date_utils.clone(this.gantt_start);
|
cur_date = date_utils.clone(this.gantt_start);
|
||||||
} else {
|
} else {
|
||||||
if (this.view_is(VIEW_MODE.YEAR)) {
|
if (this.view_is(VIEW_MODE.YEAR)) {
|
||||||
@ -487,7 +485,7 @@ export default class Gantt {
|
|||||||
createSVG('rect', {
|
createSVG('rect', {
|
||||||
x,
|
x,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: this.options.column_width,
|
width: (this.view_is('Day') ? 1 : 2) * this.options.column_width,
|
||||||
height,
|
height,
|
||||||
class: 'holiday-highlight',
|
class: 'holiday-highlight',
|
||||||
append_to: this.layers.grid,
|
append_to: this.layers.grid,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user