Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit b33e6aeed9236b888d824dc1415f674625c64488 1 parent 7fc1e16
Adam Shaw arshaw authored

Showing 2 changed files with 101 additions and 4 deletions. Show diff stats Hide diff stats

  1. +6 4 src/date_util.js
  2. +95 0 tests/issue_750.html
10 src/date_util.js
@@ -167,7 +167,7 @@ function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
167 167 return null;
168 168 }
169 169 var date = new Date(m[1], 0, 1);
170   - if (ignoreTimezone || !m[14]) {
  170 + if (ignoreTimezone || !m[13]) {
171 171 var check = new Date(m[1], 0, 1, 9, 0);
172 172 if (m[3]) {
173 173 date.setMonth(m[3] - 1);
@@ -203,9 +203,11 @@ function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
203 203 m[10] || 0,
204 204 m[12] ? Number("0." + m[12]) * 1000 : 0
205 205 );
206   - var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
207   - offset *= m[15] == '-' ? 1 : -1;
208   - date = new Date(+date + (offset * 60 * 1000));
  206 + if (m[14]) {
  207 + var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
  208 + offset *= m[15] == '-' ? 1 : -1;
  209 + date = new Date(+date + (offset * 60 * 1000));
  210 + }
209 211 }
210 212 return date;
211 213 }
95 tests/issue_750.html
... ... @@ -0,0 +1,95 @@
  1 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2 +<html>
  3 +<head>
  4 +<script type='text/javascript' src='../src/_loader.js?debug'></script>
  5 +<script type='text/javascript'>
  6 +
  7 + $(document).ready(function() {
  8 +
  9 + var date = new Date();
  10 + var d = date.getDate();
  11 + var m = date.getMonth();
  12 + var y = date.getFullYear();
  13 +
  14 + $('#calendar').fullCalendar({
  15 + header: {
  16 + left: 'prev,next today',
  17 + center: 'title',
  18 + right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
  19 + },
  20 + editable: true,
  21 + year: 2011,
  22 + month: 6, // august
  23 + ignoreTimezone: false,
  24 + events: [
  25 + {
  26 + title: 'All Day Event',
  27 + start: '2011-07-05T12:00:00Z', // august
  28 + allDay: false
  29 + },
  30 + {
  31 + title: 'Long Event',
  32 + start: new Date(y, m, d-5),
  33 + end: new Date(y, m, d-2)
  34 + },
  35 + {
  36 + id: 999,
  37 + title: 'Repeating Event',
  38 + start: new Date(y, m, d-3, 16, 0),
  39 + allDay: false
  40 + },
  41 + {
  42 + id: 999,
  43 + title: 'Repeating Event',
  44 + start: new Date(y, m, d+4, 16, 0),
  45 + allDay: false
  46 + },
  47 + {
  48 + title: 'Meeting',
  49 + start: new Date(y, m, d, 10, 30),
  50 + allDay: false
  51 + },
  52 + {
  53 + title: 'Lunch',
  54 + start: new Date(y, m, d, 12, 5),
  55 + end: new Date(y, m, d, 14, 43),
  56 + allDay: false
  57 + },
  58 + {
  59 + title: 'Birthday Party',
  60 + start: new Date(y, m, d+1, 19, 0),
  61 + end: new Date(y, m, d+1, 22, 30),
  62 + allDay: false
  63 + },
  64 + {
  65 + title: 'Click for Google',
  66 + start: new Date(y, m, 28),
  67 + end: new Date(y, m, 29),
  68 + url: 'http://google.com/'
  69 + }
  70 + ]
  71 + });
  72 +
  73 + });
  74 +
  75 +</script>
  76 +<style type='text/css'>
  77 +
  78 + body {
  79 + margin-top: 40px;
  80 + text-align: center;
  81 + font-size: 13px;
  82 + font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
  83 + }
  84 +
  85 + #calendar {
  86 + width: 900px;
  87 + margin: 0 auto;
  88 + }
  89 +
  90 +</style>
  91 +</head>
  92 +<body>
  93 +<div id='calendar'></div>
  94 +</body>
  95 +</html>

0 comments on commit b33e6ae

Please sign in to comment.
Something went wrong with that request. Please try again.