react-tailwindcss-datepicker icon indicating copy to clipboard operation
react-tailwindcss-datepicker copied to clipboard

Add support for date localization

Open rain2o opened this issue 1 year ago • 2 comments

While trying to use this date picker, I've found it rather challenging to offer localized date formats, as I do everywhere else in my app. I believe the easiest way to accomplish this would be to add the LocalizedFormat plugin for dayjs.

An alternative option would be to allow a format function in lieu of a format string. So I could pass something like formatter={(value) => new Date(value).toLocaleDateString()}. This would offer more robust options in the long-term, but of course would require a bit more effort to introduce and maintain.

rain2o avatar Mar 30 '24 12:03 rain2o

Did you ever solve this? I am looking for a way to use my next-intl formatter to format the date as i do all other places in my application.

jeghedderchristoffer avatar Apr 23 '25 13:04 jeghedderchristoffer

Did you ever solve this? I am looking for a way to use my next-intl formatter to format the date as i do all other places in my application.

Unfortunately, I don't remember. This was a prototype project I was working on a year ago, and I haven't worked on it since then. I just checked the code, and I think I just dealt without it for now since it isn't production. I did leave a note to myself to update once this was merged: https://github.com/onesine/react-tailwindcss-datepicker/pull/236. Though I don't remember why, it looks like it has been merged, but I haven't worked on the project since then.

rain2o avatar Apr 23 '25 18:04 rain2o