Add Support for Custom Calendar Attributes in Dates Components #7276
Replies: 4 comments 2 replies
-
To better support non-Gregorian calendars across the entire project, I propose making changes so that the necessary attributes are injected into all components and the main DatesProvider. This approach would ensure that when users need a calendar system other than the Gregorian calendar, the change applies globally throughout the project, rather than having to manually add the required attributes in each individual component. This would simplify the process for developers and ensure consistency across the application, as the non-Gregorian calendar settings would be inherited wherever dates are handled. |
Beta Was this translation helpful? Give feedback.
-
When using the dayjs library, the library itself defines the weekdays starting from the number 1. For example, in the Persian calendar, the week starts on Saturday, so the first day of the week is set to 1. However, in your implementation, you also use the firstDayOfWeek attribute to specify the starting day of the week and rely on this value throughout the application. This creates a conflict between the firstDayOfWeek attribute and the internal weekday configuration of the dayjs library, which can lead to inconsistencies in other calendars. |
Beta Was this translation helpful? Give feedback.
-
Currently, I'm not planning to work on this feature as I do not use and not planning to use it in my projects in the future. You are welcome to create a separate package that supports it and publish it on npm. To get started, you can use the extension template – https://github.com/mantinedev/extension-template |
Beta Was this translation helpful? Give feedback.
-
fixed it #7302 |
Beta Was this translation helpful? Give feedback.
-
Dependencies check up
What version of @mantine/* packages do you have in package.json?
Latest
What package has an issue?
@mantine/dates
What framework do you use?
Next.js
In which browsers you can reproduce the issue?
All
Describe the bug
Description:
To enable the implementation of other calendars, it seems that dayjs and its plugins are sufficient. However, the issue lies in the flexibility of certain date-related functions.
If the two functions,
getMonthDays
andisSameMonth
, could be injected into the component as attributes, the problem would be fully resolved.Proposed Solution:
Allow
getMonthDays
andisSameMonth
to be passed as attributes when calling the component. This would make the component more adaptable to different calendar systems without requiring extensive modifications.Benefits:
If possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
Beta Was this translation helpful? Give feedback.
All reactions