themouette/jquery-week-calendar

"dateTime.getTime is not a function" using freebusys option in JSON data

Opened this issue · 0 comments

events.json

{
  events: [ ... ],
  freebusys: [
    {"start":"2013-03-11T08:10:00+01:00","end":"2013-03-11T10:00:00+01:00","free":true},
    ...
  ]
}

weekCalendar init

  ...
  $calendar.weekCalendar('option', 'data', 'events.json');
  $calendar.weekCalendar('refresh');

This example rise "dateTime.getTime is not a function" javascript error.
I haven't found the exact reason, but with this use case the functions freebusy.getStart() and freebusy.getEnd() don't return a Date object.

Quick fix, change this:

      getStart: function() {return this.getOption('start')},
      getEnd: function() {return this.getOption('end')},

with this:

      getStart: function() {return new Date(this.getOption('start'))},
      getEnd: function() {return new Date(this.getOption('end'))},

This is just a quick fix, we have to find why freebusy start and end aren't date objects.