Fixes issue 17134: The Datasource seems to be sending dates without correct time zone information
authorMartin Taal <martin.taal@openbravo.com>
Wed, 01 Jun 2011 12:02:01 +0200
changeset 12633 3aee8491f0e8
parent 12632 787c2bf6dca6
child 12634 eb7f8acad0c8
Fixes issue 17134: The Datasource seems to be sending dates without correct time zone information
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Wed Jun 01 11:37:37 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Wed Jun 01 12:02:01 2011 +0200
@@ -815,6 +815,7 @@
   var message = OB.I18N.getLabel(messageId);
   return message.replace(/^N/, n);
 };
+
 OB.Utilities.getTimePassed = function(
   /* date the note was created */created) {
     // 0-59 minutes: minutes
@@ -824,10 +825,12 @@
   // >30 days: months
 
   var now = new Date(), 
+      // created is in gmt
+      /// our local date has a time zone difference, correct for it
       msCreated = created.getTime(),
-      msNow = now.getTime(),
+      msNow = now.getTime() + (-1 * now.getTimezoneOffset() * 60000),
       n;
-
+  
   // time difference in days
   var diffDays = Math.floor((msNow - msCreated) / (1000 * 60 * 60 * 24));
   if (diffDays >= 30) {