Skip to content

Conversation

@balajis-qb
Copy link
Contributor

@balajis-qb balajis-qb commented Jan 9, 2026

Description

Linked issue: #6217

Problem
As mentioned in the attached issue, we have a problem with an existing feature of adding a week day class to the day component. Initially we were applying the class based on the weekday short name (E.g. react-datepicker__day--mon) as documented in this PR. However, when we removed the support of moment js, we started applying the class based on the day of month code (E.g. react-datepicker__day--001) as we used ddd instead of EEE in the formatDate function of getDayOfWeekCode. This was updated long back and now many test cases are relying on the month day class names (E.g. react-datepicker__day--001).

In this PR, I reapplied the class based on the weekday short name (E.g. react-datepicker__day--mon) as documented in this PR, without removing the month day class names. I also added a test case to verify that the class is applied correctly.

Note:
This PR is related to my another PR, where I updated the function name from getDayOfWeekCode to getDayOfMonthCode to match it's usage in the codebase.

I did not add any new examples to the docs-site as it's just an addition of a new class name to the day component without any other changes. In case you want to add any new examples, please let me know.

Changes

  • Reapplied the class based on the weekday short name (E.g. react-datepicker__day--mon) as documented in this PR, without removing the month day class names.
  • For the class name, I used the existing helper function getWeekdayShortInLocale to get the weekday short name in the default locale (en).
  • Added a test case to verify that the class is applied correctly.

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

- Function name updated to reflect day-of-month behaviour
- Removed the unused locale argument
- Documentation updated to describe ddd formatting
- No functional changes
- Apply weekday-specific classes to datepicker days.
- Used the default language (en-us) for this class name without considering user's locale
- Added tests to ensure correct application of weekday classes in default locale.

Closes Hacker0x01#6217
Fix Hacker0x01#644
@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.29%. Comparing base (548a1f3) to head (bcced21).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6219   +/-   ##
=======================================
  Coverage   99.29%   99.29%           
=======================================
  Files          30       30           
  Lines        3822     3823    +1     
  Branches     1648     1665   +17     
=======================================
+ Hits         3795     3796    +1     
  Misses         26       26           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant