Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering error if today is too far away from the tasks #412

Closed
Klaus-Valse opened this issue Aug 6, 2024 · 1 comment
Closed

Rendering error if today is too far away from the tasks #412

Klaus-Valse opened this issue Aug 6, 2024 · 1 comment

Comments

@Klaus-Valse
Copy link

I was just investigating a problem with the week and month view mode, so I tried to get a minimal working example of the original Frappé Gantt to run.
Turns out if the tasks are too far away from the current date, there is a rendering problem.
2024-08-06 12_02_43-Frappé Gantt Bug

If I change the date of the tasks to the same month as the current date, everything renders just fine.

2024-08-06 13_31_32-

The bug occurs in the main Gantt class in:

make_grid_highlights() {
    if (this.options.highlight_weekend) this.highlightWeekends()
    // highlight today's | week's | month's | year's
    if (
      this.view_is(VIEW_MODE.DAY) ||
      this.view_is(VIEW_MODE.WEEK) ||
      this.view_is(VIEW_MODE.MONTH) ||
      this.view_is(VIEW_MODE.YEAR)
    ) {
      // Used as we must find the _end_ of session if view is not Day
      const { x: left, date } = this.computeGridHighlightDimensions(this.options.view_mode)
      const top = this.options.header_height + this.options.padding / 2;
      const height = (this.options.bar_height + this.options.padding) * this.tasks.length;
      this.$current_highlight = this.create_el({ top, left, height, classes: 'current-highlight', append_to: this.$container })
      let $today = document.getElementById(date_utils.format(date).replaceAll(' ', '_'))  // <- $today ends up being null

      $today.classList.add('current-date-highlight')
      $today.style.top = +$today.style.top.slice(0, -2) - 4 + 'px'
      $today.style.left = +$today.style.left.slice(0, -2) - 8 + 'px'
    }
  }
@safwansamsudeen
Copy link
Collaborator

Fixed in #423, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants