Skip to content

Fix minute.round with non-integer TZ offsets#46

Merged
vogievetsky merged 3 commits intomasterfrom
fix-minute-timezone-issue
Nov 29, 2025
Merged

Fix minute.round with non-integer TZ offsets#46
vogievetsky merged 3 commits intomasterfrom
fix-minute-timezone-issue

Conversation

@jgoz
Copy link
Copy Markdown
Contributor

@jgoz jgoz commented Nov 28, 2025

Fix minute.round to respect timezone parameter for non-UTC timezones and non-integer offsets.

The minute.round function was ignoring the timezone parameter, causing incorrect bucket alignment for durations like PT20M when used with timezones that have non-integer hour offsets (e.g., Asia/Kolkata at UTC+5:30).

For example, with PT20M and Asia/Kolkata:

  • Before: 12:00 UTC (17:30 IST) rounded to 12:00 UTC (wrong)
  • After: 12:00 UTC (17:30 IST) rounds to 11:50 UTC (17:20 IST, correct)

Changes:

  • Updated minute.round to check timezone and use local minutes for non-UTC
  • Test coverage for minute shifter and Duration

The fix follows the same pattern used by hour.round, which already correctly handles timezone-aware rounding.

@jgoz jgoz requested a review from vogievetsky November 28, 2025 03:47
Copy link
Copy Markdown
Member

@vogievetsky vogievetsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gr 🎱

@vogievetsky vogievetsky merged commit 0fcbb0e into master Nov 29, 2025
1 check passed
@vogievetsky vogievetsky deleted the fix-minute-timezone-issue branch November 29, 2025 07:28
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.

2 participants