calendar

the interface of the working calendar object

object calendar;
Details

Read the Work Time Calculation article for detailed info on working calendars.

The calendar object possesses the following methods and properties:

Methods

  • setWorkTime(config) - sets the working time for the Gantt chart
calendar.setWorkTime({ hours:[9,18] });
  • unsetWorkTime(config) unsets a working time in the Gantt Chart
calendar.unsetWorkTime({ hours:[9,18] });
  • isWorkTime(date[,time_unit]) checks whether the specified date is working
    • date - (Date) a date to check
    • time_unit - (string) optional, a time unit: "minute", "hour", "day", "week", "month", "year"
      or
    • config - (object) the configuration object of a time span
var calendar = gantt.getTaskCalendar(task);
if (calendar.isWorkTime({date: date})){
    alert("worktime of task" + task.text);
}
  • getClosestWorkTime(config) - returns the closest working time
calendar.getClosestWorkTime({
    date:new Date(2013,0,1), 
    dir:"future", 
    unit:"hour"
});
  • calculateEndDate(start,duration[,unit]) - calculates the end date of a task
    • start - (Date) the date when a task is scheduled to begin
    • duration - (number) the duration of a task
    • unit - (string) optional, the time unit of the duration
      or
    • config - (object) the configuration object of a time span
var end_date = calendar.calculateEndDate({start_date:date, duration:duration});
  • calculateDuration(start,end) - calculates the duration of a task
    • start - (Date) the date when a task is scheduled to begin
    • end - (Date) the date when a task is scheduled to be completed
      or
    • config - (object) the configuration object of a time span
calendar.calculateDuration(new Date(2013,02,15), new Date(2013,02,25));

Properties

  • id - (id) the id of a task's calendar
See also
Back to top