utc icon indicating copy to clipboard operation
utc copied to clipboard

Clarifying date-fns compatibility

Open fturmel opened this issue 1 year ago • 2 comments

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.

fturmel avatar Apr 08 '24 21:04 fturmel

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.

kenlyon avatar Apr 16 '24 17:04 kenlyon

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...

JonathonRP avatar May 01 '24 22:05 JonathonRP