import { default } from "https://deno.land/x/date_fns@v2.12.0/roundToNearestMinutes/index.js";
Examples
// Round 10 July 2014 12:12:34 to nearest minute:
var result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34))
//=> Thu Jul 10 2014 12:13:00
// Round 10 July 2014 12:12:34 to nearest minute: var result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34)) //=> Thu Jul 10 2014 12:13:00
// Round 10 July 2014 12:07:30 to nearest quarter hour:
var result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34), { nearestTo: 15 })
// rounds up because given date is exactly between 12:00:00 and 12:15:00
//=> Thu Jul 10 2014 12:15:00
// Round 10 July 2014 12:07:30 to nearest quarter hour: var result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34), { nearestTo: 15 }) // rounds up because given date is exactly between 12:00:00 and 12:15:00 //=> Thu Jul 10 2014 12:15:00