From 7070f2e6baa9fa43d299de023e839d25ed26c959 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Wed, 14 Oct 2009 05:55:00 +0000 Subject: [PATCH] 1.3.2 --- changelog.txt | 9 +++++++ docs/events-and-sources.txt | 10 +++++-- docs/index.txt | 6 +++++ docs/methods.txt | 11 ++++++++ src/main.js | 36 +++++++++++++------------ src/util.js | 53 ++++++++++++++++++------------------- tests/methods.html | 1 + version.txt | 2 +- 8 files changed, 81 insertions(+), 47 deletions(-) diff --git a/changelog.txt b/changelog.txt index fcb4554..cf9dd8c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,13 @@ +version 1.3.2 (10/13/09) + - Bugfixes (please upgrade from 1.3.1!) + - squashed potential infinite loop when addMonths and addDays + is called with an invalid date + - $.fullCalendar.parseDate() now correctly parses IETF format + - when switching views, the 'today' button sticks inactive, fixed + - gotoDate now can accept a single Date argument + - documentation for changes in 1.3.1 and 1.3.2 now on website + version 1.3.1 (9/30/09) - Important Bugfixes (please upgrade from 1.3!) - When current date was late in the month, for long months, and prev/next buttons diff --git a/docs/events-and-sources.txt b/docs/events-and-sources.txt index c25f25a..af896fc 100755 --- a/docs/events-and-sources.txt +++ b/docs/events-and-sources.txt @@ -78,7 +78,7 @@ CalEvent: **title**: String The text on an event's element -**allDay**: Boolean (optional, defaults to ``true``) +**allDay**: Boolean (optional, defaults to ``true``, see :ref:`allDayDefault ` option) Determines whether the start-date and end-date's times should be ignored. If ``true``, times will be ignored. If ``false``, times will be considered, displaying them on each event (like the text '3pm'). @@ -107,7 +107,13 @@ CalEvent: the end date is *exclusive*. This is only a gotcha when your ``end`` has time 00:00. It means your event ends on midnight, and it will *not* span through the next day. - + +**url**: String (optional) + A URL that will be visited when this event is clicked by the user. + By default, the new page will be opened in the current window, but one + may specify an ``eventClick`` :ref:`Triggered Action ` for + more complex behavior (just remember to return ``false`` to prevent the default action). + **className**: String/Array (optional) A CSS class (or array of classes) that will be attached to this event's element. diff --git a/docs/index.txt b/docs/index.txt index 4e3e2cd..72ac763 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -72,6 +72,12 @@ Basic Options The ``aspectRatio`` will NOT be maintained however. Each week will have a constant height, meaning the calendar's height will change month-to-month. +.. _allDayDefault: + +**allDayDefault**: Boolean, *Default*: ``true`` + Determines the default value for each :ref:`CalEvent's ` ``allDay`` property, + when it is unspecified. + Event Editing ============= diff --git a/docs/methods.txt b/docs/methods.txt index fa7add2..740a800 100755 --- a/docs/methods.txt +++ b/docs/methods.txt @@ -19,9 +19,15 @@ jQuery object: ``month`` is 0-based, meaning January=0, February=1, etc. + This method can also be called with a single argument, a Date object. + **incrementDate** - .fullCalendar('incrementDate', *years, [months, [days]]*) Moves the calendar forward/backward an arbitrary amount of time. +**changeView** - .fullCalendar('changeView', *viewName*) + Immediately switches to a different view. ``viewName`` must be one of the + :ref:`available-views`. + **updateEvent** - .fullCalendar('updateEvent', *calEvent*) Reports changes to a :ref:`CalEvent's ` standard properties. This will cause the event to be rerendered on the calendar. @@ -75,4 +81,9 @@ jQuery object: **refetchEvents** - .fullCalendar(``'refetchEvents'``) Refetches events from all sources and rerenders them on the screen. + +**render** - .fullCalendar(``'render'``) + Immediately renders the calendar. This method is automatically called if the $().fullCalendar + plugin is called on a visible element. However, if a hidden/invisible element is initialized + with FullCalendar, this method must be explicitly called as soon as the element becomes visible. \ No newline at end of file diff --git a/src/main.js b/src/main.js index e9c31a8..c83fa36 100755 --- a/src/main.js +++ b/src/main.js @@ -208,15 +208,6 @@ $.fn.fullCalendar = function(options) { }); ignoreWindowResizes = false; view.date = cloneDate(date); - if (header) { - // enable/disable 'today' button - var today = new Date(); - if (today >= view.start && today < view.end) { - header.find('div.fc-button-today').addClass(tm + '-state-disabled'); - }else{ - header.find('div.fc-button-today').removeClass(tm + '-state-disabled'); - } - } } else if (view.sizeDirty) { view.updateSize(); @@ -231,6 +222,13 @@ $.fn.fullCalendar = function(options) { if (header) { // update title text header.find('h2.fc-header-title').html(view.title); + // enable/disable 'today' button + var today = new Date(); + if (today >= view.start && today < view.end) { + header.find('div.fc-button-today').addClass(tm + '-state-disabled'); + }else{ + header.find('div.fc-button-today').removeClass(tm + '-state-disabled'); + } } view.sizeDirty = false; view.eventsDirty = false; @@ -373,14 +371,18 @@ $.fn.fullCalendar = function(options) { }, gotoDate: function(year, month, dateNum) { - if (year != undefined) { - date.setYear(year); - } - if (month != undefined) { - date.setMonth(month); - } - if (dateNum != undefined) { - date.setDate(dateNum); + if (typeof year == 'object') { + date = cloneDate(year); // provided 1 argument, a Date + }else{ + if (year != undefined) { + date.setYear(year); + } + if (month != undefined) { + date.setMonth(month); + } + if (dateNum != undefined) { + date.setDate(dateNum); + } } render(); }, diff --git a/src/util.js b/src/util.js index c3e6cfc..2367e89 100755 --- a/src/util.js +++ b/src/util.js @@ -14,31 +14,35 @@ function addYears(d, n, keepTime) { } function addMonths(d, n, keepTime) { // prevents day overflow/underflow - var m = d.getMonth() + n, - check = cloneDate(d); - check.setDate(1); - check.setMonth(m); - d.setMonth(m); - if (!keepTime) { - clearTime(d); - } - while (d.getMonth() != check.getMonth()) { - d.setDate(d.getDate() + (d < check ? 1 : -1)); + if (+d) { // prevent infinite looping on invalid dates + var m = d.getMonth() + n, + check = cloneDate(d); + check.setDate(1); + check.setMonth(m); + d.setMonth(m); + if (!keepTime) { + clearTime(d); + } + while (d.getMonth() != check.getMonth()) { + d.setDate(d.getDate() + (d < check ? 1 : -1)); + } } return d; } function addDays(d, n, keepTime) { // deals with daylight savings - var dd = d.getDate() + n, - check = cloneDate(d); - check.setHours(12); // set to middle of day - check.setDate(dd); - d.setDate(dd); - if (!keepTime) { - clearTime(d); - } - while (d.getDate() != check.getDate()) { - d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS); + if (+d) { // prevent infinite looping on invalid dates + var dd = d.getDate() + n, + check = cloneDate(d); + check.setHours(12); // set to middle of day + check.setDate(dd); + d.setDate(dd); + if (!keepTime) { + clearTime(d); + } + while (d.getDate() != check.getDate()) { + d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS); + } } return d; } @@ -79,14 +83,14 @@ var parseDate = fc.parseDate = function(s) { if (s.match(/^\d+$/)) { // a UNIX timestamp return new Date(parseInt(s) * 1000); } - return parseISO8601(s, true) || Date.parse(s) || null; + return parseISO8601(s, true) || new Date(s) || null; } return null; } var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) { // derived from http://delete.me.uk/2005/03/iso8601.html - var d = s.match(parseISO8601Regex); + var d = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/); if (!d) return null; var offset = 0; var date = new Date(d[1], 0, 1); @@ -106,11 +110,6 @@ var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) { return new Date(Number(date) + (offset * 60 * 1000)); } -var parseISO8601Regex = new RegExp( - "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" + - "(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" + - "(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?"); - /* Date Formatting diff --git a/tests/methods.html b/tests/methods.html index 98e9773..8aa2306 100644 --- a/tests/methods.html +++ b/tests/methods.html @@ -127,6 +127,7 @@ + diff --git a/version.txt b/version.txt index 6261a05..d5e98f7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.3.1 \ No newline at end of file +1.3.2 \ No newline at end of file