cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/master to 8c8853e
Date Thu, 27 Mar 2014 21:12:28 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 8d34419c5 -> 8c8853e0e


CLOUDSTACK-6296: UI > If an account's timezone is not set, show datetime field based on
browser's timezoneoffset.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8c8853e0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8c8853e0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8c8853e0

Branch: refs/heads/master
Commit: 8c8853e0e2809be1631f10b9c5836954aeea4900
Parents: 8d34419
Author: Jessica Wang <jessicawang@apache.org>
Authored: Thu Mar 27 14:12:05 2014 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Thu Mar 27 14:12:19 2014 -0700

----------------------------------------------------------------------
 ui/scripts/sharedFunctions.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8c8853e0/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 9c24f40..4d4344e 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -919,11 +919,18 @@ cloudStack.converters = {
             var disconnected = new Date();
             disconnected.setISO8601(UtcDate);
 
-            if (g_timezoneoffset != null)
+            if (g_timezoneoffset != null) {
                 localDate = disconnected.getTimePlusTimezoneOffset(g_timezoneoffset);
-            else
-                localDate = disconnected.toUTCString();
-            // localDate = disconnected.getTimePlusTimezoneOffset(0);
+            } else {                
+            	var browserDate = new Date();
+            	var browserTimezoneoffset = browserDate.getTimezoneOffset();            	
+            	if (browserTimezoneoffset == undefined || isNaN(browserTimezoneoffset) ) { 
          		
+            		localDate = disconnected.toUTCString();
+            	} else {
+            		g_timezoneoffset = (browserTimezoneoffset/60) * (-1);
+            		localDate = disconnected.getTimePlusTimezoneOffset(g_timezoneoffset);
+            	}       
+            }
         }
         return localDate;
     },


Mime
View raw message