payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
28.74k stars 1.78k forks source link

Datepicker component in dayOnly mode injects incorrect TZ #8625

Open max-degterev opened 1 month ago

max-degterev commented 1 month ago

Link to reproduction

No response

Describe the Bug

Using the default dayOnly mode for date picker results in TZ being embedded together with the date, which in turn leads to incorrect day being saved: 2024-10-18T22:00:00.000Z instead of 2024-10-19T00:00:00.000Z etc.

The bug stems from react-datepicker, there is no workaround without patching it client side, which requires replacing your date component with a custom component. Just a FYI.

To Reproduce

just use dates

Payload Version

v2

Adapters and Plugins

No response

max-degterev commented 1 month ago

~Looks like it has been patched here: https://github.com/NouanceLabs/payload-better-fields-plugin?tab=readme-ov-file#date-field~ nope, creates an additional timezone field for some reason 🤷

no fix, gonna have to rawdog psql to update, fun!

p.s. ofc the fix would be to lock the tz to utc in "dayonly" mode. in case someone picks this up