Skip to content

Conversation

@balajis-qb
Copy link
Collaborator

Description

Linked issue: Hacker0x01#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.

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
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.

2 participants