Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed issue 750 (Z in date parsing) and added test

  • Loading branch information...
commit b33e6aeed9236b888d824dc1415f674625c64488 1 parent 7fc1e16
@arshaw arshaw authored
Showing with 101 additions and 4 deletions.
  1. +6 −4 src/date_util.js
  2. +95 −0 tests/issue_750.html
View
10 src/date_util.js
@@ -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);
@@ -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;
}
View
95 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>
Please sign in to comment.
Something went wrong with that request. Please try again.