✨ Add weekday class support to datepicker days#6219
Open
balajis-qb wants to merge 2 commits intoHacker0x01:mainfrom
Open
✨ Add weekday class support to datepicker days#6219balajis-qb wants to merge 2 commits intoHacker0x01:mainfrom
balajis-qb wants to merge 2 commits intoHacker0x01:mainfrom
Conversation
- 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 useddddinstead ofEEEin the formatDate function ofgetDayOfWeekCode. 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
react-datepicker__day--mon) as documented in this PR, without removing the month day class names.getWeekdayShortInLocaleto get the weekday short name in the default locale (en).Contribution checklist