My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 336 attachment: 0002-Allow-the-ignore-timezone-setting-to-be-adjustable-w.patch (1.9 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 507fd941517e88eb80ca829dafe03e025b5f04bc Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Thu, 11 Mar 2010 09:13:37 -0500
Subject: [PATCH 2/2] Allow the "ignore timezone" setting to be adjustable when parsing ISO8601 dates

---
src/main.js | 6 ++++--
src/util.js | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main.js b/src/main.js
index 2971951..d2fe31e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -44,6 +44,8 @@ var defaults = {
timeFormat: { // for event elements
'': 'h(:mm)t' // default
},
+ // ignoreTimezone for ISO8601 dates in added Events
+ ignoreTimezone: true,

// locale
isRTL: false,
@@ -853,8 +855,8 @@ function normalizeEvent(event, options) {
}
delete event.date;
}
- event._start = cloneDate(event.start = parseDate(event.start));
- event.end = parseDate(event.end);
+ event._start = cloneDate(event.start = parseDate(event.start, options.ignoreTimezone));
+ event.end = parseDate(event.end, options.ignoreTimezone);
if (event.end && event.end <= event.start) {
event.end = null;
}
diff --git a/src/util.js b/src/util.js
index 1a8095f..ee6df31 100644
--- a/src/util.js
+++ b/src/util.js
@@ -96,7 +96,7 @@ function skipWeekend(date, inc, excl) {
/* Date Parsing
-----------------------------------------------------------------------------*/

-var parseDate = fc.parseDate = function(s) {
+var parseDate = fc.parseDate = function(s, ignoreTimezone) {
if (typeof s == 'object') { // already a Date object
return s;
}
@@ -107,7 +107,7 @@ var parseDate = fc.parseDate = function(s) {
if (s.match(/^\d+$/)) { // a UNIX timestamp
return new Date(parseInt(s) * 1000);
}
- return parseISO8601(s, true) || (s ? new Date(s) : null);
+ return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
}
// TODO: never return invalid dates (like from new Date(<string>)), return null instead
return null;
--
1.7.0.2

Powered by Google Project Hosting