change date format based on locale globally #10574
Replies: 1 comment
-
You're getting type errors here because the That being said, this is done automatically for you when we invoke this function. Each translation that Payload provides already has a predefined pattern, including the Persian language. Do you have translations enabled in your config? This is done via the {
// ...
i18n: {
supportedLanguages: ['fa']
}
} I am, however, seeing that the We could potentially provide some mechanism for you to do this yourself in the future, completely bypassing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
I'm working on a Payload CMS project that needs to display and input dates in different formats depending on the user's locale. For example, I want to display dates in "YYYY-MM-DD" format for English and "jYYYY/jMM/jDD" for Persian. (Jalali datefns for persian = https://www.npmjs.com/package/date-fns-jalali)
I've tried using the dateFormats property within the admin configuration, but I'm encountering some type errors. I'm not sure if I'm correctly defining the types for this property.
Here's a simplified version of my code:
Beta Was this translation helpful? Give feedback.
All reactions