Conversation
This commit addresses issue #1413 where the playhead was misaligned by approximately 1 hour when using UTC timezone. Changes: - Modified _calculatePlayheadFromTime() method to handle timezone-aware date calculations - Added UTC-specific date handling to ensure consistent positioning - Imported utcToZonedTime from date-fns-tz for proper timezone conversion - Added comprehensive Playwright tests for playhead positioning with different timezones The fix ensures that when timezone="UTC" is specified, both the timeline start and playhead times are processed consistently to avoid timezone offset issues. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
✅ Deploy Preview for astro-stencil ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for astro-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes timezone alignment issues for the timeline playhead component, ensuring consistent positioning across different timezone configurations. The changes address a bug where the playhead position calculation was inconsistent when using UTC timezone versus other timezones.
- Updated playhead position calculation logic to handle UTC and non-UTC timezones consistently
- Added comprehensive test coverage for timezone-specific playhead positioning scenarios
Reviewed Changes
Copilot reviewed 2 out of 9 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/web-components/src/components/rux-timeline/rux-timeline.tsx | Updated playhead calculation logic to properly handle UTC and timezone conversions using date-fns-tz |
| packages/web-components/src/components/rux-timeline/test/timeline.spec.ts | Added test suite for timezone handling with UTC and America/New_York timezone scenarios |
Files not reviewed (7)
- packages/angular-workspace/package-lock.json: Language not supported
- packages/angular-workspace/projects/angular/package-lock.json: Language not supported
- packages/framework-testing/astro-angular/package-lock.json: Language not supported
- packages/framework-testing/astro-react/package-lock.json: Language not supported
- packages/framework-testing/astro-vue/package-lock.json: Language not supported
- packages/react/package-lock.json: Language not supported
- packages/web-components/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
packages/web-components/src/components/rux-timeline/test/timeline.spec.ts:618
- The test comment suggests both playheads should be at the same position, but there's no assertion to verify this behavior. Consider adding assertions to compare the relative positions of UTC and EST playheads.
// Both should be positioned at the same relative location since we're using the same UTC times
packages/web-components/src/components/rux-timeline/rux-timeline.tsx
Outdated
Show resolved
Hide resolved
packages/web-components/src/components/rux-timeline/test/timeline.spec.ts
Show resolved
Hide resolved
Address code review feedback by replacing redundant Date object creation with explicit UTC time calculations for better timezone normalization. Changes: - Remove redundant new Date(date.getTime()) operations that provided no timezone benefit - Use explicit millisecond-based calculations for UTC timezone case - Maintain timezone-aware date-fns functions for non-UTC timezones - Consolidate interval-specific logic for cleaner code structure - Fix month interval calculation to properly handle both UTC and non-UTC cases This provides a more explicit and reliable approach to UTC handling while maintaining backward compatibility with existing timezone functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Brief Description
JIRA Link
Related Issue
General Notes
Motivation and Context
Issues and Limitations
Types of changes
Checklist