Skip to content

fix(gantt): keep exact dates when dragging or clicking bars - #8570

Merged
mejo- merged 1 commit into
mainfrom
fix/gantt_snap_dates
Oct 20, 2026
Merged

mejo- merged 1 commit into
mainfrom
fix/gantt_snap_dates

Conversation

@mejo-

@mejo- mejo- commented Oct 20, 2026

Copy link
Copy Markdown
Member

frappe-gantt converts the bar position back to dates in whole units, truncating fractions. In the month view this snapped dates to the turn of the month, and bars shorter than a month ended one second before they started. The week and day views lost the time of day or minutes. The conversion also ran on any mouse movement while a bar was pressed, so just clicking a bar to open the card changed its dates.

Take the card dates from the store when a drag starts and shift them by the dragged distance instead. Full days are added on the calendar so the time of day is kept across DST changes. Clicking a bar without moving it no longer saves anything.

Assisted-by: ClaudeCode:claude-opus-5-5

How to test manually

  1. Open any board and create a card. In the card details, set:
    • Start: 30 Oct 2026, 09:30
    • Due: 29 Nov 2026, 17:15
      Use dates near today with non-zero minutes. That makes the rounding easy to see, and the Gantt view hides cards whose due date is more than a year in the past.
  2. Open DevTools, go to the Network tab and filter for cards/. Every save shows up there as a PUT /ocs/v2.php/apps/deck/api/v1.0/cards/, and the payload has the exact startdate and duedate that were sent.
  3. Switch the board to Gantt view using the view switcher in the board header.
  4. Click Months.
  5. Drag the test card slightly.
  6. See it jumping to the end of previous month.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

frappe-gantt converts the bar position back to dates in whole units,
truncating fractions. In the month view this snapped dates to the turn
of the month, and bars shorter than a month ended one second before
they started. The week and day views lost the time of day or minutes.
The conversion also ran on any mouse movement while a bar was pressed,
so just clicking a bar to open the card changed its dates.

Take the card dates from the store when a drag starts and shift them by
the dragged distance instead. Full days are added on the calendar so the
time of day is kept across DST changes. Clicking a bar without moving it
no longer saves anything.

Signed-off-by: Jonas <jonas@freesources.org>
Assisted-by: ClaudeCode:claude-opus-5-5
@mejo- mejo- self-assigned this Oct 20, 2026
@mejo-
mejo- requested a review from luka-nextcloud as a code owner October 20, 2026 10:25
@github-project-automation github-project-automation Bot moved this to 馃Л Planning evaluation (don't pick) in 馃摑 Productivity team Oct 20, 2026
@mejo-
mejo- requested a review from grnd-alt as a code owner October 20, 2026 10:25
@mejo- mejo- moved this from 馃Л Planning evaluation (don't pick) to 馃憖 In review in 馃摑 Productivity team Oct 20, 2026
@mejo-

mejo- commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

/backport to stable35

@mejo-

mejo- commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

/backport to stable34

@mejo-
mejo- merged commit a9cd969 into main Oct 20, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from 馃憖 In review to 鈽戯笍 Done in 馃摑 Productivity team Oct 20, 2026
@mejo-
mejo- deleted the fix/gantt_snap_dates branch October 20, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 鈽戯笍 Done

Development

Successfully merging this pull request may close these issues.

2 participants