Skip to content

add new function roundToNearestMinutes#928

Merged
kossnocorp merged 2 commits into
date-fns:masterfrom
xkizer:iss-787
Oct 18, 2018
Merged

add new function roundToNearestMinutes#928
kossnocorp merged 2 commits into
date-fns:masterfrom
xkizer:iss-787

Conversation

@xkizer
Copy link
Copy Markdown
Contributor

@xkizer xkizer commented Oct 13, 2018

Fixes #787

@xkizer xkizer force-pushed the iss-787 branch 2 times, most recently from 46d79c9 to dd4f96e Compare October 14, 2018 00:33
@kossnocorp kossnocorp added the 🎉 Feature #265d21 label Oct 18, 2018
@kossnocorp kossnocorp self-requested a review October 18, 2018 10:51
@kossnocorp kossnocorp self-assigned this Oct 18, 2018
Copy link
Copy Markdown
Member

@kossnocorp kossnocorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Thank you a lot!

@kossnocorp kossnocorp merged commit 9b0cfbf into date-fns:master Oct 18, 2018
@kossnocorp
Copy link
Copy Markdown
Member

The PR was released as v2.0.0-alpha.23. See the change log: https://gist.github.com/kossnocorp/a307a464760b405bb78ef5020a4ab136#v200-alpha23

Thank you for your great work!

@dcrystalj
Copy link
Copy Markdown

this is very limited just 1 to 30 minutes. What about 33 minutes ?
Also there should be option to round to nearest seconds, hours. days, weeks...

@kossnocorp
Copy link
Copy Markdown
Member

@dcrystalj please elaborate your use case for rounding to 33 minutes. Regarding the seconds, hours, whatever, the function is called roundToNearestMinutes so it's should not.

@dcrystalj
Copy link
Copy Markdown

@kossnocorp sorry my point was just that we need more generic function. I would expect of this fn to work if I give it roundToNearestMinutes(date, 120) same as roundToNearestHour(date, 2)

RIght now in my project I need function to round to nearest hour, 3 hours, day and 3 day... Maybe we should just open issues to implement roundToNearestHour, and roundToNearestDay ...

@kossnocorp
Copy link
Copy Markdown
Member

@dcrystalj yeah, that makes sense. Feel free to open those, but also send PRs.

@xkizer
Copy link
Copy Markdown
Contributor Author

xkizer commented Oct 29, 2018

@kossnocorp if you file a separate issue I can try to work on it. Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants