Skip to content

feat(datepicker): add outside days styling support#1674

Open
Fejjal94 wants to merge 4 commits intothemesberg:mainfrom
Fejjal94:fix/datepicker-outside-days-style
Open

feat(datepicker): add outside days styling support#1674
Fejjal94 wants to merge 4 commits intothemesberg:mainfrom
Fejjal94:fix/datepicker-outside-days-style

Conversation

@Fejjal94
Copy link
Copy Markdown

@Fejjal94 Fejjal94 commented May 3, 2026

Problem

Out-of-month days in the Datepicker render with the same
visual emphasis as in-month days, making the calendar
harder to scan.

Solution

  • Added outside style key to DatepickerViewsDaysTheme
  • Detect out-of-month days with isOutside variable
  • Apply opacity-40 text-gray-400 to out-of-month days
  • Selected days override the outside styling

Related Issue

Fixes #1647

Summary by CodeRabbit

  • New Features

    • Datepicker now visually distinguishes dates that fall outside the current month view (applies only to unselected days) to provide clearer calendar context when navigating months.
  • Style

    • Day cells outside the current month use a muted gray tone and reduced opacity to de-emphasize them, improving visual scanning and focus on in-month dates.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 3, 2026

⚠️ No Changeset found

Latest commit: 6260c31

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 3, 2026

Someone is attempting to deploy a commit to the Bergside Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

📝 Walkthrough

Walkthrough

The Datepicker now marks days outside the viewed month with a new outside theme class; the theme adds outside: string and default text-gray-400 opacity-40, and Days rendering applies this class when a date's month differs from the view month (unless selected).

Changes

Out-of-Month Day Styling

Layer / File(s) Summary
Data Shape / Theme Interface
packages/ui/src/components/Datepicker/Views/Days.tsx
Adds outside: string to DatepickerViewsDaysTheme.items.item.
Theme Default Styling
packages/ui/src/components/Datepicker/theme.ts
Defines views.days.items.item.outside with text-gray-400 opacity-40.
Core Implementation
packages/ui/src/components/Datepicker/Views/Days.tsx
Calculates isOutside by comparing currentDate.getMonth() to viewDate.getMonth() and conditionally merges theme.items.item.outside into the day button classes when outside and not selected.
Component Metadata
packages/ui/src/components/Datepicker/Views/Days.tsx
Sets DatepickerViewsDays.displayName.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • SutuSebastian

Poem

🐰 Softly I nibble at calendar rows,
Outside days dim where the moonlight goes.
A whisper of gray, a gentle fade,
Selected stars remain unafraid.
Hop—now the month blooms, clear and made. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(datepicker): add outside days styling support' accurately reflects the main change of introducing outside day styling for the datepicker component.
Linked Issues check ✅ Passed The PR fully addresses the requirements from issue #1647: adds an 'outside' theme token to DatepickerViewsDaysTheme, detects out-of-month dates, applies reduced opacity/muted text styling, and ensures selected styling overrides.
Out of Scope Changes check ✅ Passed All changes are scoped to the datepicker component's outside day styling implementation with no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ui/src/components/Datepicker/Views/Days.tsx (1)

16-29: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep the new theme key backward-compatible.

Making outside required on the exported DatepickerViewsDaysTheme is a breaking type change for any consumer that provides a fully typed custom datepicker theme. Make it optional, or keep a default fallback so existing overrides continue to compile.

♻️ Suggested fix
 export interface DatepickerViewsDaysTheme {
   header: {
     base: string;
     title: string;
   };
   items: {
     base: string;
     item: {
       base: string;
       selected: string;
       disabled: string;
       today: string;
-      outside: string;
+      outside?: string;
     };
   };
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/Datepicker/Views/Days.tsx` around lines 16 - 29,
The new required "outside" key on the exported DatepickerViewsDaysTheme is a
breaking change; make the property optional on DatepickerViewsDaysTheme
(outside?: string) and ensure the Days view uses a fallback when reading
theme.items.item.outside (e.g., default to the existing base/today/disabled
class) so existing custom themes that don't include outside continue to compile
and behave predictably; update any code that destructures or accesses
theme.items.item.outside in the Days component to use the fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/ui/src/components/Datepicker/Views/Days.tsx`:
- Around line 16-29: The new required "outside" key on the exported
DatepickerViewsDaysTheme is a breaking change; make the property optional on
DatepickerViewsDaysTheme (outside?: string) and ensure the Days view uses a
fallback when reading theme.items.item.outside (e.g., default to the existing
base/today/disabled class) so existing custom themes that don't include outside
continue to compile and behave predictably; update any code that destructures or
accesses theme.items.item.outside in the Days component to use the fallback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fc17130f-4982-4805-9000-2d41b94e07d1

📥 Commits

Reviewing files that changed from the base of the PR and between 0f526aa and e6a86e3.

📒 Files selected for processing (2)
  • packages/ui/src/components/Datepicker/Views/Days.tsx
  • packages/ui/src/components/Datepicker/theme.ts

@Fejjal94
Copy link
Copy Markdown
Author

Fejjal94 commented May 5, 2026

Hi team! All CI checks are now passing
Could someone please review this PR?
It fixes issue #1647. Thank you!

Copy link
Copy Markdown
Collaborator

@SutuSebastian SutuSebastian left a comment

Choose a reason for hiding this comment

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

remove ajouté comments

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
packages/ui/src/components/Datepicker/Views/Days.tsx (1)

69-69: 💤 Low value

Optional: include year in the isOutside check for completeness.

Month-only comparison is safe within a 42-cell grid (a same-month-number date from a different year can never appear in the window), but the intent of "not in the same calendar month" is more precisely expressed with both components.

♻️ Proposed fix
-          const isOutside = currentDate.getMonth() !== viewDate.getMonth(); 
+          const isOutside =
+            currentDate.getMonth() !== viewDate.getMonth() ||
+            currentDate.getFullYear() !== viewDate.getFullYear();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/components/Datepicker/Views/Days.tsx` at line 69, The
isOutside boolean in Days.tsx currently only compares currentDate.getMonth() to
viewDate.getMonth(); update this to also compare years so it truly reflects "not
in the same calendar month" (e.g., set isOutside using currentDate.getMonth()
!== viewDate.getMonth() || currentDate.getFullYear() !==
viewDate.getFullYear()). Locate the const isOutside that uses currentDate and
viewDate and change the expression accordingly so same-month-number from a
different year is treated as outside.
packages/ui/src/components/Datepicker/theme.ts (1)

53-53: 💤 Low value

Optional: add a dark-mode variant to outside for explicit dark mode styling.

text-gray-400 sits in the same Tailwind variant bucket as text-gray-900 from base, so twMerge will correctly override it in light mode. However, dark:text-white from base lives in a separate variant bucket and is not overridden by text-gray-400. The net result in dark mode is white text at 40% opacity rather than the intended muted-gray tone.

🎨 Proposed fix
-          outside: "text-gray-400 opacity-40", 
+          outside: "text-gray-400 opacity-40 dark:text-gray-500",

(Note: the existing disabled key has the same gap — this can be addressed separately.)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/components/Datepicker/theme.ts` at line 53, Update the
Datepicker theme's outside key to include an explicit dark-mode variant so
dark-mode uses a muted gray instead of white at reduced opacity; replace or
extend the current value ("text-gray-400 opacity-40") with something that adds a
dark variant such as "text-gray-400 opacity-40 dark:text-gray-400/40" (adjust
classes to match your Tailwind config) in the theme object where the outside key
is defined; (note: the disabled key has the same issue and can be fixed
similarly).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/ui/src/components/Datepicker/theme.ts`:
- Line 53: Update the Datepicker theme's outside key to include an explicit
dark-mode variant so dark-mode uses a muted gray instead of white at reduced
opacity; replace or extend the current value ("text-gray-400 opacity-40") with
something that adds a dark variant such as "text-gray-400 opacity-40
dark:text-gray-400/40" (adjust classes to match your Tailwind config) in the
theme object where the outside key is defined; (note: the disabled key has the
same issue and can be fixed similarly).

In `@packages/ui/src/components/Datepicker/Views/Days.tsx`:
- Line 69: The isOutside boolean in Days.tsx currently only compares
currentDate.getMonth() to viewDate.getMonth(); update this to also compare years
so it truly reflects "not in the same calendar month" (e.g., set isOutside using
currentDate.getMonth() !== viewDate.getMonth() || currentDate.getFullYear() !==
viewDate.getFullYear()). Locate the const isOutside that uses currentDate and
viewDate and change the expression accordingly so same-month-number from a
different year is treated as outside.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7aaf4457-44df-4e32-82ea-88c35976edbb

📥 Commits

Reviewing files that changed from the base of the PR and between e377b02 and 664edaa.

📒 Files selected for processing (2)
  • packages/ui/src/components/Datepicker/Views/Days.tsx
  • packages/ui/src/components/Datepicker/theme.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui/src/components/Datepicker/theme.ts`:
- Line 53: The "outside" style entry in theme.ts uses "text-gray-400 opacity-40"
but lacks a dark-mode override, so twMerge can't override base's
"dark:text-white"; update the "outside" entry to include a dark-mode muted color
(e.g., add a "dark:text-<muted-gray>" token) so outside days render muted in
dark mode as well — modify the "outside" key in the theme object (alongside the
existing "base" key) to include the dark: text class.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 531b52a0-e552-4460-9d53-0bb4de987447

📥 Commits

Reviewing files that changed from the base of the PR and between 664edaa and 6260c31.

📒 Files selected for processing (2)
  • packages/ui/src/components/Datepicker/Views/Days.tsx
  • packages/ui/src/components/Datepicker/theme.ts

Comment thread packages/ui/src/components/Datepicker/theme.ts
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.

Support out-of-month days style

2 participants