Skip to content

fix: Calendar timezone day-shift bug (#7048)#10459

Merged
ArtyomSavchenko merged 1 commit intohcengineering:developfrom
domocarroll:fix/calendar-timezone-7048
Jan 29, 2026
Merged

fix: Calendar timezone day-shift bug (#7048)#10459
ArtyomSavchenko merged 1 commit intohcengineering:developfrom
domocarroll:fix/calendar-timezone-7048

Conversation

@domocarroll
Copy link
Contributor

@domocarroll domocarroll commented Jan 29, 2026

Summary

Fixes #7048 - Calendar events appearing shifted by one day.

Problem

Events scheduled for today were appearing in tomorrow's column. The toCalendar function in DayCalendar.svelte used raw millisecond arithmetic (MILLISECONDS_IN_DAY * day + date.getTime()) which doesn't handle timezone transitions properly when combined with setHours().

Solution

  • Replace millisecond arithmetic with Date.setDate() for proper calendar day calculations
  • Fix mutation bug where the date parameter was being modified directly

Changes

- const startDay = new Date(MILLISECONDS_IN_DAY * day + date.getTime()).setHours(0, 0, 0, 0)
+ const targetDay = new Date(date)
+ targetDay.setDate(targetDay.getDate() + day)
+ const startDay = new Date(targetDay).setHours(0, 0, 0, 0)

Testing

  • Tested in Brisbane timezone (GMT+10)
  • Events now display in correct day column
  • Navigation forward/back preserves correct positioning

🤖 Generated with Claude Code

@huly-github-staging
Copy link

Connected to Huly®: UBERF-15325

@domocarroll domocarroll force-pushed the fix/calendar-timezone-7048 branch from a496e05 to 2ee6bfe Compare January 29, 2026 04:52
@domocarroll
Copy link
Contributor Author

Thank you for the feedback @ArtyomSavchenko. I've cleaned up the PR:

  • Force pushed to keep only the calendar fix commit
  • Removed all unrelated changes (AI widget, CI workflows, version changes, etc.)

The PR now contains a single commit with just the DayCalendar.svelte fix.

Apologies for the messy initial submission - I'll be more careful to keep PRs focused going forward.

Events scheduled for today were appearing in tomorrow's column due to
raw millisecond arithmetic not handling timezone transitions properly.

Changes:
- Replace MILLISECONDS_IN_DAY * day arithmetic with Date.setDate()
- Fix mutation bug where date parameter was being modified
- Use proper calendar day arithmetic that handles DST/timezone

Tested in Brisbane timezone (GMT+10) - events now display in correct column.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Dominic O'Carroll <99632940+domocarroll@users.noreply.github.com>
@domocarroll domocarroll force-pushed the fix/calendar-timezone-7048 branch from 2ee6bfe to 353de06 Compare January 29, 2026 04:59
@ArtyomSavchenko
Copy link
Member

Thank you for the feedback @ArtyomSavchenko. I've cleaned up the PR:

  • Force pushed to keep only the calendar fix commit
  • Removed all unrelated changes (AI widget, CI workflows, version changes, etc.)

The PR now contains a single commit with just the DayCalendar.svelte fix.

Apologies for the messy initial submission - I'll be more careful to keep PRs focused going forward.

Thank you again for your contribution and for quickly addressing the feedback.

@ArtyomSavchenko ArtyomSavchenko merged commit b27b511 into hcengineering:develop Jan 29, 2026
12 checks passed
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

Successfully merging this pull request may close these issues.

Bug: Calendar Display and Sync Issues in Planner: Incorrect Day Assignments and Missing Google Calendar Sync

2 participants