seankenny / fullcalendar

Full-sized drag & drop event calendar (jQuery plugin)
http://arshaw.com/fullcalendar/
MIT License
60 stars 39 forks source link

Replacing the old date api by the momentjs API #18

Closed zvictor closed 10 years ago

zvictor commented 10 years ago

Hi there!

I have replaced almost all the calls to the old date API by the new API.

= )

zvictor commented 10 years ago

There is one function call I was not able to replace, though. Does anybody else could help me to understand the behavior of zeroDate()?

function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1
    var i=0, d;
    do {
        d = new Date(1970, i++, 1);
    } while (d.getHours()); // != 0
    return d;
}

Won't d.getHours() be always zero? This way, a call to zeroDate() would always give us new Date(1970, 0, 1).

The comment saying that dateOfMonth=1 confuses me even more. What I am not seeing here?

seankenny commented 10 years ago

Hi Victor - thanks a lot for this!

See comment on addDays.

Also, there is dayDiff being called in ResourceEventRenderer.js which should probably change from dayDelta = dayDiff(date, origDate); to dayDelta = date.diff(origDate, 'days');

Same for parseTime and formatDates.

I'll catch these ones today.