forwardported some changes from 1.3, more progress towards 1.4

This commit is contained in:
Adam Shaw 2009-10-14 07:01:55 +00:00
parent 0cf59ac85c
commit 3576075da1
6 changed files with 73 additions and 38 deletions

View file

@ -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) version 1.3.1 (9/30/09)
- Important Bugfixes (please upgrade from 1.3!) - Important Bugfixes (please upgrade from 1.3!)
- When current date was late in the month, for long months, and prev/next buttons - When current date was late in the month, for long months, and prev/next buttons

View file

@ -78,7 +78,7 @@ CalEvent:
**title**: String **title**: String
The text on an event's element The text on an event's element
**allDay**: Boolean (optional, defaults to ``true``) **allDay**: Boolean (optional, defaults to ``true``, see :ref:`allDayDefault <allDayDefault>` option)
Determines whether the start-date and end-date's times should be ignored. 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, If ``true``, times will be ignored. If ``false``, times will be considered,
displaying them on each event (like the text '3pm'). 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. 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. 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 <triggered-actions>` for
more complex behavior (just remember to return ``false`` to prevent the default action).
**className**: String/Array (optional) **className**: String/Array (optional)
A CSS class (or array of classes) that will be attached to this event's A CSS class (or array of classes) that will be attached to this event's
element. element.

View file

@ -72,6 +72,12 @@ Basic Options
The ``aspectRatio`` will NOT be maintained however. Each week will have The ``aspectRatio`` will NOT be maintained however. Each week will have
a constant height, meaning the calendar's height will change month-to-month. 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 <CalEvent>` ``allDay`` property,
when it is unspecified.
Event Editing Event Editing
============= =============

View file

@ -19,9 +19,15 @@ jQuery object:
``month`` is 0-based, meaning January=0, February=1, etc. ``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]]*) **incrementDate** - .fullCalendar('incrementDate', *years, [months, [days]]*)
Moves the calendar forward/backward an arbitrary amount of time. 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*) **updateEvent** - .fullCalendar('updateEvent', *calEvent*)
Reports changes to a :ref:`CalEvent's <CalEvent>` standard properties. Reports changes to a :ref:`CalEvent's <CalEvent>` standard properties.
This will cause the event to be rerendered on the calendar. This will cause the event to be rerendered on the calendar.
@ -75,4 +81,9 @@ jQuery object:
**refetchEvents** - .fullCalendar(``'refetchEvents'``) **refetchEvents** - .fullCalendar(``'refetchEvents'``)
Refetches events from all sources and rerenders them on the screen. 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.

View file

@ -383,14 +383,18 @@ $.fn.fullCalendar = function(options) {
}, },
gotoDate: function(year, month, dateNum) { gotoDate: function(year, month, dateNum) {
if (year != undefined) { if (typeof year == 'object') {
date.setYear(year); date = cloneDate(year); // provided 1 argument, a Date
} }else{
if (month != undefined) { if (year != undefined) {
date.setMonth(month); date.setYear(year);
} }
if (dateNum != undefined) { if (month != undefined) {
date.setDate(dateNum); date.setMonth(month);
}
if (dateNum != undefined) {
date.setDate(dateNum);
}
} }
render(); render();
}, },

View file

@ -15,31 +15,35 @@ function addYears(d, n, keepTime) {
} }
function addMonths(d, n, keepTime) { // prevents day overflow/underflow function addMonths(d, n, keepTime) { // prevents day overflow/underflow
var m = d.getMonth() + n, if (+d) { // prevent infinite looping on invalid dates
check = cloneDate(d); var m = d.getMonth() + n,
check.setDate(1); check = cloneDate(d);
check.setMonth(m); check.setDate(1);
d.setMonth(m); check.setMonth(m);
if (!keepTime) { d.setMonth(m);
clearTime(d); if (!keepTime) {
} clearTime(d);
while (d.getMonth() != check.getMonth()) { }
d.setDate(d.getDate() + (d < check ? 1 : -1)); while (d.getMonth() != check.getMonth()) {
d.setDate(d.getDate() + (d < check ? 1 : -1));
}
} }
return d; return d;
} }
function addDays(d, n, keepTime) { // deals with daylight savings function addDays(d, n, keepTime) { // deals with daylight savings
var dd = d.getDate() + n, if (+d) { // prevent infinite looping on invalid dates
check = cloneDate(d); var dd = d.getDate() + n,
check.setHours(12); // set to middle of day check = cloneDate(d);
check.setDate(dd); check.setHours(12); // set to middle of day
d.setDate(dd); check.setDate(dd);
if (!keepTime) { d.setDate(dd);
clearTime(d); if (!keepTime) {
} clearTime(d);
while (d.getDate() != check.getDate()) { }
d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS); while (d.getDate() != check.getDate()) {
d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS);
}
} }
return d; return d;
} }
@ -80,14 +84,14 @@ var parseDate = fc.parseDate = function(s) {
if (s.match(/^\d+$/)) { // a UNIX timestamp if (s.match(/^\d+$/)) { // a UNIX timestamp
return new Date(parseInt(s) * 1000); return new Date(parseInt(s) * 1000);
} }
return parseISO8601(s, true) || Date.parse(s) || null; return parseISO8601(s, true) || new Date(s) || null;
} }
return null; return null;
} }
var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) { var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) {
// derived from http://delete.me.uk/2005/03/iso8601.html // 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; if (!d) return null;
var offset = 0; var offset = 0;
var date = new Date(d[1], 0, 1); var date = new Date(d[1], 0, 1);
@ -107,11 +111,6 @@ var parseISO8601 = fc.parseISO8601 = function(s, ignoreTimezone) {
return new Date(Number(date) + (offset * 60 * 1000)); 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 /* Date Formatting
@ -277,7 +276,7 @@ function setOuterHeight(element, height, includeMargins) {
var operaPositionBug; var operaPositionBug;
function reportTBody(tbody) { function reportTBody(tbody) { // TODO: have agenda use this too
if (operaPositionBug == undefined) { if (operaPositionBug == undefined) {
operaPositionBug = tbody.position().top != tbody.find('tr').position().top; operaPositionBug = tbody.position().top != tbody.find('tr').position().top;
} }