Related to issue 25936 and Fixed issue 26644: Removed custom function
authorDavid Baz Fayos <david.baz@openbravo.com>
Wed, 21 May 2014 23:58:53 +0200
changeset 23088 4083ef59b102
parent 23087 2e94293e0e22
child 23089 6395bf98637f
Related to issue 25936 and Fixed issue 26644: Removed custom function
'endsWith' implemented by Smartclint to ensure that standalone files work properly with other libraries
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-datetime.js
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/form/formitem/ob-formitem-datetime.js	Wed May 21 18:40:37 2014 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-datetime.js	Wed May 21 23:58:53 2014 +0200
@@ -137,7 +137,7 @@
     } else {
       this.showPickerTimeItem = false;
     }
-    if (OB.Format.dateTime.toUpperCase().endsWith(' A')) {
+    if (OB.Format.dateTime.toUpperCase().lastIndexOf(' A') !== -1 && OB.Format.dateTime.toUpperCase().lastIndexOf(' A') === OB.Format.dateTime.length - 2) {
       this.use24HourTime = false;
     } else {
       this.use24HourTime = true;
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js	Wed May 21 18:40:37 2014 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js	Wed May 21 23:58:53 2014 +0200
@@ -80,7 +80,7 @@
 
   timeFormat = OB.Format.dateTime.substring(OB.Format.dateTime.indexOf(' ') + 1);
 
-  if (timeFormat && timeFormat.toLowerCase().endsWith('a')) {
+  if (timeFormat && timeFormat.toUpperCase().lastIndexOf(' A') !== -1 && timeFormat.toUpperCase().lastIndexOf(' A') === timeFormat.length - 2) {
     is24h = false;
   }
 
@@ -238,7 +238,7 @@
   if (!isADate) {
     return null;
   }
-  if (dateFormat.toUpperCase().endsWith(' A')) {
+  if (dateFormat.toUpperCase().lastIndexOf(' A') !== -1 && dateFormat.toUpperCase().lastIndexOf(' A') === dateFormat.length - 2) {
     is24h = false;
   }