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

Issue 1076 attachment: unix_tstamp_ignoretimezone.patch (1.5 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
From c67c794fbae0e5eae61806243283b2e97eb22492 Mon Sep 17 00:00:00 2001
From: unknown <luca.b@.(none)>
Date: Thu, 11 Aug 2011 21:43:37 +0200
Subject: [PATCH] Unix Timestamp ignoreTimeZone fix

---
src/date_util.js | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/date_util.js b/src/date_util.js
index 9e2037a..943b6fb 100644
--- a/src/date_util.js
+++ b/src/date_util.js
@@ -143,11 +143,23 @@ function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
return s;
}
if (typeof s == 'number') { // a UNIX timestamp
- return new Date(s * 1000);
+ if( ignoreTimezone == true ){
+ var lclDate = new Date(s * 1000);
+ return new Date( lclDate.valueOf() + ( lclDate.getTimezoneOffset() * 60 *1000 ) );
+ }
+ else{
+ return new Date(s * 1000);
+ }
}
if (typeof s == 'string') {
if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp
- return new Date(parseFloat(s) * 1000);
+ if( ignoreTimezone == true ){
+ var lclDate = new Date(parseFloat(s) * 1000);
+ return new Date( lclDate.valueOf() + ( lclDate.getTimezoneOffset() * 60 *1000 ) );
+ }
+ else{
+ return new Date(parseFloat(s) * 1000);
+ }
}
if (ignoreTimezone === undefined) {
ignoreTimezone = true;
--
1.7.4.msysgit.0

Powered by Google Project Hosting