Skip to content

Conversation

@theolebarq
Copy link

@theolebarq theolebarq commented Aug 1, 2025

Fixed the calendar component when endMonth property is added.

Fixes: #7894

For example: on a current calendar, when you add the endMonth property
Capture d’écran 2025-08-01 à 19 56 19

Now with fix:
Capture d’écran 2025-08-01 à 19 56 57

@vercel
Copy link

vercel bot commented Aug 1, 2025

Someone is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@theolebarq theolebarq marked this pull request as ready for review August 1, 2025 18:05
@xpt300
Copy link

xpt300 commented Aug 2, 2025

I recenlty spotted this issue too!

@tzuennn
Copy link

tzuennn commented Aug 9, 2025

While this fixes the end of month issue, it introduces a regression at the start of month where days are no longer correctly aligned.

Problem with Current Fix

Start of month alignment broken

The issue is that completely removing the w-full class breaks the calendar's grid alignment. Days at the start of the month now have inconsistent spacing and aren't properly aligned with the week headers.

Root Cause

The original problem (#7894) occurs because w-full forces cells to take full available width, which causes overflow when there are fewer days at the end of the month. However, completely removing width constraints breaks the overall calendar layout structure.

Suggested Solution

Instead of removing all width constraints, we should use a more targeted approach:

day: cn(
  "group/day relative aspect-square h-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
  "w-auto [tr:first-child_&]:w-full",
  defaultClassNames.day
)

This should preserve start-of-month alignment while avoiding end-of-month overflow.

@theolebarq
Copy link
Author

theolebarq commented Sep 2, 2025

@tzuennn

I have taken your feedback into consideration.

@theolebarq
Copy link
Author

theolebarq commented Oct 27, 2025

Now, with this correction, when we added endMonth={new Date(2030, 11)}, it fixes the problem! What do you think?
In test mode:

Capture d’écran 2025-10-27 à 17 37 13 Capture d’écran 2025-10-27 à 17 37 28

@vbachele
Copy link

oh I also had this issue thank for offering the fix

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]: DatePicker UI issue

4 participants