From 069b73fe5db418d37665b5c7d6e579a5d9d6706b Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 20 Oct 2026 12:17:09 +0200 Subject: [PATCH] fix(gantt): keep exact dates when dragging or clicking bars 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 Assisted-by: ClaudeCode:claude-opus-5-5 --- package-lock.json | 27 +--------- package.json | 1 + src/components/board/GanttView.vue | 71 ++++++++++++++++--------- src/helpers/ganttDates.js | 60 +++++++++++++++++++++ src/helpers/ganttDates.spec.js | 83 ++++++++++++++++++++++++++++++ 5 files changed, 193 insertions(+), 49 deletions(-) create mode 100644 src/helpers/ganttDates.js create mode 100644 src/helpers/ganttDates.spec.js diff --git a/package-lock.json b/package-lock.json index 6b6aecc9f9..4cc3393749 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,6 +47,7 @@ "vue3-smooth-dnd": "^0.0.6" }, "devDependencies": { + "@jest/globals": "^29.7.0", "@nextcloud/babel-config": "^1.3.0", "@nextcloud/browserslist-config": "^3.0.1", "@nextcloud/e2e-test-server": "^0.5.1", @@ -2314,7 +2315,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2331,7 +2331,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2348,7 +2347,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2365,7 +2363,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2382,7 +2379,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2399,7 +2395,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2416,7 +2411,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2433,7 +2427,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2450,7 +2443,6 @@ "cpu": [ "arm" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2467,7 +2459,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2484,7 +2475,6 @@ "cpu": [ "ia32" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2501,7 +2491,6 @@ "cpu": [ "loong64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2518,7 +2507,6 @@ "cpu": [ "mips64el" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2535,7 +2523,6 @@ "cpu": [ "ppc64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2552,7 +2539,6 @@ "cpu": [ "riscv64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2569,7 +2555,6 @@ "cpu": [ "s390x" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2586,7 +2571,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2603,7 +2587,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2620,7 +2603,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2637,7 +2619,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2654,7 +2635,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2671,7 +2651,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2688,7 +2667,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2705,7 +2683,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2722,7 +2699,6 @@ "cpu": [ "ia32" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2739,7 +2715,6 @@ "cpu": [ "x64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ diff --git a/package.json b/package.json index f4cd1eb1a1..00bfc6ecbe 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "npm": "^11.3.0" }, "devDependencies": { + "@jest/globals": "^29.7.0", "@nextcloud/babel-config": "^1.3.0", "@nextcloud/browserslist-config": "^3.0.1", "@nextcloud/e2e-test-server": "^0.5.1", diff --git a/src/components/board/GanttView.vue b/src/components/board/GanttView.vue index 0eaeca01dd..d6e1026447 100644 --- a/src/components/board/GanttView.vue +++ b/src/components/board/GanttView.vue @@ -13,7 +13,10 @@ -
+