Skip to content

Commit

Permalink
fixed issue 750 (Z in date parsing) and added test
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Aug 22, 2011
1 parent 7fc1e16 commit b33e6ae
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/date_util.js
Expand Up @@ -167,7 +167,7 @@ function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
return null;
}
var date = new Date(m[1], 0, 1);
if (ignoreTimezone || !m[14]) {
if (ignoreTimezone || !m[13]) {
var check = new Date(m[1], 0, 1, 9, 0);
if (m[3]) {
date.setMonth(m[3] - 1);
Expand Down Expand Up @@ -203,9 +203,11 @@ function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
m[10] || 0,
m[12] ? Number("0." + m[12]) * 1000 : 0
);
var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
offset *= m[15] == '-' ? 1 : -1;
date = new Date(+date + (offset * 60 * 1000));
if (m[14]) {
var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
offset *= m[15] == '-' ? 1 : -1;
date = new Date(+date + (offset * 60 * 1000));
}
}
return date;
}
Expand Down
95 changes: 95 additions & 0 deletions tests/issue_750.html
@@ -0,0 +1,95 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type='text/javascript' src='../src/_loader.js?debug'></script>
<script type='text/javascript'>

$(document).ready(function() {

var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
},
editable: true,
year: 2011,
month: 6, // august
ignoreTimezone: false,
events: [
{
title: 'All Day Event',
start: '2011-07-05T12:00:00Z', // august
allDay: false
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 5),
end: new Date(y, m, d, 14, 43),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
]
});

});

</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>
<div id='calendar'></div>
</body>
</html>

0 comments on commit b33e6ae

Please sign in to comment.