How to round to next/previous 15 minutes?
Open
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
`const now = dayjs(); // e.g. 'HH:mm' is 17:37`
But what I want to modify the object to snap to `17:30` or `17:45`.
Is there a way to do it? "Rounding" only seems to be a thing in relative time, which is not what I'm looking for.
Contributor guide
Research direction
Start by reviewing the existing Day.js APIs and documentation for unit manipulation and relative-time rounding. Determine how a value such as 17:37 should snap to the nearest 15-minute boundary, then verify that the resulting API or documented approach handles both previous and next boundaries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100