Skip to content

Round to nearest X of interval #787

@LandonSchropp

Description

@LandonSchropp

Sorry if this has already been answered, but I searched the issues and docs and didn't see anything like this.

Is there a way to round to the nearest X of an interval with date-fns? For example, is there anything like this?

roundToNearestMinute(new Date())
roundToNearestMinutes(new Date(), 5)
roundToNearest(new Date(), 5, "minutes")

startOfMinutes(new Date(), 5)
startOf(new Date(), 5, "minutes")

endOfMinutes(new Date(), 5)
endOf(new Date(), 5, "minutes")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions