payloadcms/payload

Ability to set the date field type for different languages ​​in the field admin

Opened this issue · 1 comments

I suggest that this possibility be created so that the date field can be set in the admin, so that, for example, this date field can be of historical type. For example, if we enable the Arabic language in the languages, the date can be selected not in Gregorian but in lunar form. For the Persian language, the date can be selected in solar form, not in Gregorian form.

Hi team! 👋
I'm interested in implementing this feature and would like to contribute a PR for it. Before I start working on it, I wanted to confirm a few things:
Is this feature accepted?
Would the Payload team be open to accepting a PR that adds calendar type support to the date field? This would allow users to select dates using different calendar systems (Jalali/Persian, Hijri/Islamic, Gregorian) based on their locale or explicit configuration.
Proposed API Design:
I'm thinking of adding a configuration option like this:
typescript{
name: 'eventDate',
type: 'date',
admin: {
date: {
calendar: 'jalali', // 'gregorian' | 'jalali' | 'hijri' | 'auto'
// 'auto' would detect based on the current locale
}
}
}
Implementation Approach:

Add calendar type option to the date field config schema
Create/modify the date picker component to support different calendar systems
Ensure dates are always stored in UTC/ISO format in the database (only the UI representation changes)
Add appropriate date conversion utilities
Include tests and documentation

Questions:

Does this approach align with Payload's architecture?
Are there any specific libraries or patterns you'd prefer for the date picker implementation?
Should the calendar type be auto-detected based on the locale, or should it be explicitly configurable (or both)?

I'd appreciate any feedback or guidance before I start working on this. Thanks! 🙏