Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed dayjs another local and calendar #7302

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

baravak
Copy link

@baravak baravak commented Dec 24, 2024

fixed #7276

@baravak
Copy link
Author

baravak commented Dec 27, 2024

The issue in the test was solely due to a Prettier syntax error, which has been fixed, and the test was re-run. Thank you!
@rtivital

@baravak
Copy link
Author

baravak commented Dec 27, 2024

The issue encountered was not an actual operational error. It was caused by attempting to match the date with exact hours and seconds, which was unnecessary. However, it has been resolved, and the test was re-run.
I apologize for the recurrence of the issue.
@rtivital

@baravak
Copy link
Author

baravak commented Dec 27, 2024

Summary of Changes

Phase 1: Refactoring and Bug Fixes

  • Reimplemented getStartOfWeek, getEndOfWeek, and getMonthDays:
    These functions, previously relying on Date, were refactored to use dayjs.

    • This resolved bugs related to non-Gregorian calendars.
    • It also ensured the appropriate usage of dayjs. If it wasn't meant to be used, there was no need to include it in the code. However, the original implementation implied it was intended to leverage dayjs features.
  • Injected dayjs where missing:
    Replaced direct Date usage in areas that caused errors in non-Gregorian calendars with dayjs, ensuring consistency and calendar compatibility.

Phase 2: Simplification and Optimization

  • Removed custom isSameMonth function:
    Replaced it with the built-in isSame method from dayjs, which serves the same purpose more effectively.

Why These Changes?

Although it was mentioned in previous issues that there’s no current plan to support non-Gregorian calendars, these adjustments create an opportunity for the library to accommodate such calendars seamlessly in the future.


These simple changes allowed the Mantine library to support non-Gregorian calendars without disrupting its core functionality. Developers using non-Gregorian calendars and Mantine can now do so without facing related issues.

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