rounds the specified date to the nearest date in the time scale
date | Date | RoundDateConfig | the Date object to round or an object with settings |
Date | the rounded Date object |
var today = gantt.roundDate(new Date());
If the specified date should be rounded to the nearest date, pass the Date object as a parameter to the method:
var today = gantt.roundDate(new Date());
console.log(today);
If the specified date should be rounded to the nearest date considering the unit of time, pass an object with settings to the roundDate() method. The object can take the following attributes:
var today = gantt.roundDate({
date: new Date(),
unit: "hour",
step: 1
});
console.log(today);