date-fns icon indicating copy to clipboard operation
date-fns copied to clipboard

`roundToNearestMinutes` fixes and improvements

Open fturmel opened this issue 3 years ago • 4 comments
trafficstars

Closes #3129

The recent addition of the roundingMethod option (#3091) was not implemented correctly, and some unit tests were not checking for the right behavior. This PR fixes the problems, adds several unit tests, improves the JS docs and adds two additional examples.

I've also internally renamed the getRoundingMethod file and made the function as a default export for consistency to match other functions in the library.

fturmel avatar Jul 26 '22 03:07 fturmel

@im28 Would you mind reviewing the PR, especially the unit tests to make sure everything checks out and there are no missing edge cases?

fturmel avatar Jul 26 '22 03:07 fturmel

Just pushed an update to cover an edge case with ceil and milliseconds.

fturmel avatar Jul 26 '22 11:07 fturmel

Hi, would someone be able to fix these merge conflicts so this can be released? I'm relying on this fix for a development! Thanks :)

@fturmel

MrSuttonmann avatar Aug 05 '22 15:08 MrSuttonmann

It seems like main has become the working branch for pre-released v3 since I opened this, which explains all the conflicts.

@leshakoss @tan75 I'm going to wait for you to chime in before changing anything. If you want to accept the PR, let me know if you want to merge into the v2 branch instead, or if I should get rid of the conflicts against main.

Obviously the fixes in this PR should find their way to both v2 and upcoming v3.

fturmel avatar Aug 05 '22 17:08 fturmel

Any updates on this PR?

Miyagee avatar Sep 27 '22 13:09 Miyagee

While this PR hasn't been merged, I'm using this simple custom solution https://stackoverflow.com/a/10789415

grifotv avatar Oct 12 '22 10:10 grifotv

Would also appreciate this being merged.

yannbolliger avatar Oct 13 '22 08:10 yannbolliger

Shipped with https://github.com/date-fns/date-fns/releases/tag/v3.2.0

kossnocorp avatar Jan 09 '24 10:01 kossnocorp