Repository navigation
Support non-Gregorian calendars (e.g. Persian/Jalali) in the admin panel #19563
asoray
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Support non-Gregorian calendars (e.g. Persian/Jalali) in the admin panel
Summary
The admin panel can only display and pick dates in the Gregorian calendar. Translating the UI
(e.g. the
fapack) translates month names, but the dates themselves stay Gregorian, soPersian editors see "۱۳ نوامبر ۲۰۲۶" instead of "۲۲ آبان ۱۴۰۵". The same applies to other
locales whose everyday calendar isn't Gregorian (Persian, Hijri, Hebrew, Buddhist, Ethiopic…).
Custom field components cover part of this, but several places have no extension point.
Checked on 3.92.1 and 4.0.0-canary.39; the relevant code is the same in both unless noted.
What can already be customised
admin.components.Cellon a date field, and oncreatedAt/updatedAtbydeclaring those fields explicitly in the collection.
admin.components.Field(e.g. a picker built on react-day-picker, whichsupports the Persian calendar).
a replacement in
admin.components.edit.beforeDocumentControls. There is no slot in thestatus row itself, so the replacement ends up beside the buttons and needs CSS to move.
What can't
All built-in date text goes through
formatDatein@payloadcms/ui/utilities/formatDocTitle/formatDateTitle.js, which calls date-fnsformatwithi18n.dateFNS. A date-fns locale only localises names; the calendar stays Gregorian. The functionis also bundled (minified) into
exports/client, so patching it isn't practical.Places that use it and offer no override:
Versions/cells/CreatedAt), the version pill label, thecompare view and its version drawer, the date field diff, and the page metadata/title.
handleGroupBy).formatDocTitlewhenuseAsTitleis a date field (also used byrelationship options/cells and thumbnail cards).
folders table.
Date input with no override:
WhereBuilder/Condition/Date) usesreact-datepicker,which is Gregorian only.
admin.components.Filterexists, butrenderFiltersskips hiddenfields (
fieldIsHiddenOrDisabled), so it can't be used forcreatedAt/updatedAt. It's alsorendered without props (no
value/onChange), so it's unclear how to wire one up.Related bug: document-locked modal ignores i18n
elements/DocumentLocked/index.jsformats the "last edited" time with a hard-codednew Intl.DateTimeFormat('en-US', …), so it shows "Nov 13, 2026, 3:13 PM" even in a fullytranslated admin, without the translated month names used everywhere else. It should at least
go through
formatDatewithi18n.dateFNSlike the rest of the UI. Still present in4.0.0-canary.39.
Proposal
Any of these would help, roughly in order of impact:
A config-level formatter, e.g.
used by every built-in date display listed above (including the document-locked modal).
A non-Gregorian calendar could then be supported with
Intl.DateTimeFormat(
'fa-IR-u-ca-persian') ordate-fns-jalali, without new dependencies in Payload.A simpler alternative would be an
admin.calendaroption passed through toIntl.A config-level date picker override (e.g.
admin.components.DatePicker), used by datefields, the list filter and the schedule publish drawer.
Let
admin.components.Filterapply to hidden fields such as timestamps, and pass itvalue,onChange,operatorandfield, like the built-inDateFilterreceives.A slot in the edit view status row, or a way to render the timestamps there with a custom
component.
Happy to provide more detail or test a canary.
All reactions