details:   https://code.openbravo.com/erp/devel/pi/rev/6395bf98637f
changeset: 23089:6395bf98637f
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu May 22 00:17:51 2014 +0200
summary:   Related to issue 25936: Sidestep Smartclient functions
to ensure that standalone files work properly with other libraries

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
 |  28 ++++++++-
 1 files changed, 23 insertions(+), 5 deletions(-)

diffs (73 lines):

diff -r 4083ef59b102 -r 6395bf98637f 
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 May 21 23:58:53 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
   Thu May 22 00:17:51 2014 +0200
@@ -114,24 +114,33 @@
 
   // if already a date then return true
   var isADate = Object.prototype.toString.call(OBDate) === '[object Date]',
+      PMIndicator = ' PM',
+      AMIndicator = ' AM',
       is24h = true,
       isPM = false;
   if (isADate) {
     return OBDate;
   }
 
+  if (isc && isc.Time && isc.Time.PMIndicator) {
+    PMIndicator = isc.Time.PMIndicator;
+  }
+  if (isc && isc.Time && isc.Time.AMIndicator) {
+    AMIndicator = isc.Time.AMIndicator;
+  }
+
   dateFormat = OB.Utilities.Date.normalizeDisplayFormat(dateFormat);
   dateFormat = dateFormat.replace(' A', '');
   var dateSeparator = dateFormat.substring(2, 3);
   var timeSeparator = dateFormat.substring(11, 12);
   var isFullYear = (dateFormat.indexOf('%Y') !== -1);
-  if (OBDate.indexOf(isc.Time.PMIndicator) !== 1 || 
OBDate.indexOf(isc.Time.AMIndicator) !== 1) {
+  if (OBDate.indexOf(PMIndicator) !== 1 || OBDate.indexOf(AMIndicator) !== 1) {
     is24h = false;
   }
-  if (!is24h && OBDate.indexOf(isc.Time.PMIndicator) !== -1) {
+  if (!is24h && OBDate.indexOf(PMIndicator) !== -1) {
     isPM = true;
   }
-  OBDate = OBDate.replace(isc.Time.AMIndicator, 
'').replace(isc.Time.PMIndicator, '');
+  OBDate = OBDate.replace(AMIndicator, '').replace(PMIndicator, '');
 
   if ((isFullYear ? OBDate.length - 2 : OBDate.length) !== dateFormat.length) {
     return null;
@@ -233,11 +242,20 @@
   dateFormat = OB.Utilities.Date.normalizeDisplayFormat(dateFormat);
 
   var isADate = Object.prototype.toString.call(JSDate) === '[object Date]',
+      PMIndicator = ' PM',
+      AMIndicator = ' AM',
       is24h = true,
       isPM = false;
   if (!isADate) {
     return null;
   }
+
+  if (isc && isc.Time && isc.Time.PMIndicator) {
+    PMIndicator = isc.Time.PMIndicator;
+  }
+  if (isc && isc.Time && isc.Time.AMIndicator) {
+    AMIndicator = isc.Time.AMIndicator;
+  }
   if (dateFormat.toUpperCase().lastIndexOf(' A') !== -1 && 
dateFormat.toUpperCase().lastIndexOf(' A') === dateFormat.length - 2) {
     is24h = false;
   }
@@ -308,9 +326,9 @@
 
   if (!is24h) {
     if (isPM) {
-      OBDate = OBDate.replace(' A', isc.Time.PMIndicator);
+      OBDate = OBDate.replace(' A', PMIndicator);
     } else {
-      OBDate = OBDate.replace(' A', isc.Time.AMIndicator);
+      OBDate = OBDate.replace(' A', AMIndicator);
     }
   }
 

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to