details:   https://code.openbravo.com/erp/devel/pi/rev/144538d99c98
changeset: 13637:144538d99c98
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Wed Aug 31 20:06:35 2011 +0200
summary:   Fixed issue 18395: Now date is right calculated also the 31th of 
each month

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
 |  22 +++++----
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (43 lines):

diff -r 0324c4da6bd2 -r 144538d99c98 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
   Wed Aug 31 18:05:14 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
   Wed Aug 31 20:06:35 2011 +0200
@@ -112,7 +112,13 @@
   var hours = dateFormat.indexOf('%H') !== -1 ? 
OBDate.substring(dateFormat.indexOf('%H'), dateFormat.indexOf('%H') + 2) : 0;
   var minutes = dateFormat.indexOf('%M') !== -1 ? 
OBDate.substring(dateFormat.indexOf('%M'), dateFormat.indexOf('%M') + 2) : 0;
   var seconds = dateFormat.indexOf('%S') !== -1 ? 
OBDate.substring(dateFormat.indexOf('%S'), dateFormat.indexOf('%S') + 2) : 0;
-  
+
+  month = parseInt(month, 10);
+  day = parseInt(day, 10);
+  hours = parseInt(hours, 10);
+  minutes = parseInt(minutes, 10);
+  seconds = parseInt(seconds, 10);
+
   if (day < 1 || day > 31 || month < 1 || month > 12 || year > 99 ||
   fullYear > 9999) {
     return null;
@@ -129,18 +135,16 @@
   // var JSDate = isc.Date.create(); /**It doesn't work in IE**/
   var JSDate = new Date();
   var centuryReference = OB.Utilities.Date.centuryReference;
-  if (isFullYear) {
-    JSDate.setFullYear(fullYear);
-  } else {
+  if (!isFullYear) {
     if (parseInt(year, 10) < centuryReference) {
-      year = '20' + year;
+      fullYear = '20' + year;
     } else {
-      year = '19' + year;
+      fullYear = '19' + year;
     }
-    JSDate.setFullYear(year);
   }
-  JSDate.setMonth(month - 1);
-  JSDate.setDate(day);
+
+  fullYear = parseInt(fullYear, 10);
+  JSDate.setFullYear(fullYear, month-1, day);
   JSDate.setHours(hours);
   JSDate.setMinutes(minutes);
   JSDate.setSeconds(seconds);

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to