fix: issue where days of week in calendar are misaligned when month s…#87
fix: issue where days of week in calendar are misaligned when month s…#87
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe Calendar component's spacer div for grid alignment is now conditionally rendered, appearing only when the firstDay offset exceeds zero. This optimizes the DOM structure while preserving calendar functionality. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🎉 This PR is included in version 6.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The calendar uses a 7-column grid where each day of the week gets a column (Sunday through Saturday). Before rendering the day numbers, an empty spacer element is inserted to push the 1st of the month into the correct column. For example, if a month starts on Thursday, the spacer spans 4 columns so that "1" appears under "Thu".
The bug: when a month starts on Sunday, no offset is needed — the 1st should go in the very first column. The code set the spacer to span 0 columns, but that's not valid, so the browser treated the spacer as a regular element taking up 1 column. This pushed every day one position to the right, making Sunday dates appear under Monday, Monday under Tuesday, etc.
The fix skips rendering the spacer entirely when the month starts on Sunday.
Summary by CodeRabbit