fixed issue 429
This commit is contained in:
parent
5f59997cf7
commit
c002cef649
25
src/main.js
25
src/main.js
|
@ -176,19 +176,8 @@ $.fn.fullCalendar = function(options) {
|
|||
if (options.theme) {
|
||||
element.addClass('ui-widget');
|
||||
}
|
||||
|
||||
if (options.year !== undefined && options.year != date.getFullYear()) {
|
||||
date.setDate(1);
|
||||
date.setMonth(0);
|
||||
date.setFullYear(options.year);
|
||||
}
|
||||
if (options.month !== undefined && options.month != date.getMonth()) {
|
||||
date.setDate(1);
|
||||
date.setMonth(options.month);
|
||||
}
|
||||
if (options.date !== undefined) {
|
||||
date.setDate(options.date);
|
||||
}
|
||||
|
||||
setYMD(date, options.year, options.month, options.date);
|
||||
|
||||
|
||||
|
||||
|
@ -528,15 +517,7 @@ $.fn.fullCalendar = function(options) {
|
|||
if (typeof year == 'object') {
|
||||
date = cloneDate(year); // provided 1 argument, a Date
|
||||
}else{
|
||||
if (year !== undefined) {
|
||||
date.setFullYear(year);
|
||||
}
|
||||
if (month !== undefined) {
|
||||
date.setMonth(month);
|
||||
}
|
||||
if (dateNum !== undefined) {
|
||||
date.setDate(dateNum);
|
||||
}
|
||||
setYMD(date, year, month, dateNum);
|
||||
}
|
||||
render();
|
||||
},
|
||||
|
|
15
src/util.js
15
src/util.js
|
@ -96,6 +96,21 @@ function dayDiff(d1, d2) { // d1 - d2
|
|||
return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS);
|
||||
}
|
||||
|
||||
function setYMD(date, y, m, d) {
|
||||
if (y !== undefined && y != date.getFullYear()) {
|
||||
date.setDate(1);
|
||||
date.setMonth(0);
|
||||
date.setFullYear(y);
|
||||
}
|
||||
if (m !== undefined && m != date.getMonth()) {
|
||||
date.setDate(1);
|
||||
date.setMonth(m);
|
||||
}
|
||||
if (d !== undefined) {
|
||||
date.setDate(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Date Parsing
|
||||
|
|
44
tests/issue_429_gotoDate.html
Normal file
44
tests/issue_429_gotoDate.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<link rel='stylesheet' type='text/css' href='../examples/redmond/theme.css' />
|
||||
<script type='text/javascript' src='loader.js'></script>
|
||||
<script type='text/javascript'>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
||||
},
|
||||
year: 2015,
|
||||
month: 0,
|
||||
date: 31
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type='text/css'>
|
||||
|
||||
body {
|
||||
margin-top: 40px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
|
||||
}
|
||||
|
||||
#calendar {
|
||||
width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="$('#calendar').fullCalendar('gotoDate', 2015, 1)">gotoDate - feb 2015</button>
|
||||
<div id='calendar'></div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue