date-fns / utc

date-fns UTC utils
70 stars 5 forks source link

Clarifying date-fns compatibility #7

Open fturmel opened 2 months ago

fturmel commented 2 months ago

While helping with https://github.com/date-fns/date-fns/issues/3755, I realized it's not particularly clearly stated that this package is meant to be used with date-fns v3 and won't work as expected with <= 2.

It would be helpful to add peerDependencies/peerDependenciesMeta fields to the package.json, and a note on compatibility in the readme.md.

Maybe also update the date-fns docs on time zones to give an overview of the package.

kenlyon commented 2 months ago

This bug report was helpful for me. Thanks for logging it!

I was trying to work out how this was meant to work because the date-fns source code I was stepping through was converting all my UTCDate inputs to regular Date objects. I was using v2 of date-fns.

It's working as intended after upgrading to 3.6.0 because the cloning logic now uses the constructor of the supplied object, preserving the UTCDate.

JonathonRP commented 1 month ago

main trying to do this with so little documentation is hard, even using 3.6.0... it doesn't stay utc from server to client... maybe should just use date-fns-tz...