phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r5119 - phpcompta/tags/rel650/html/js


From: phpcompta-dev
Subject: [Phpcompta-dev] r5119 - phpcompta/tags/rel650/html/js
Date: Sat, 29 Sep 2012 23:28:47 +0200 (CEST)

Author: danydb
Date: 2012-09-29 23:28:46 +0200 (Sat, 29 Sep 2012)
New Revision: 5119

Modified:
   phpcompta/tags/rel650/html/js/scripts.js
Log:
add the javascript function check_date and check_date_id

Modified: phpcompta/tags/rel650/html/js/scripts.js
===================================================================
--- phpcompta/tags/rel650/html/js/scripts.js    2012-09-19 20:55:43 UTC (rev 
5118)
+++ phpcompta/tags/rel650/html/js/scripts.js    2012-09-29 21:28:46 UTC (rev 
5119)
@@ -1639,4 +1639,39 @@
                                      }
                                  }
                                  );
+}
+/**
+ * @brief check if the parameter is a valid a valid date or not, returns true 
if it is valid otherwise
+ * false
+ * @parameter p_str_date the string of the date (format DD.MM.YYYY)
+ */
+function check_date(p_str_date)
+{
+    var format = /^\d{2}\.\d{2}\.\d{4}$/;
+    if(!format.test(p_str_date)){
+       return false;
+    }
+    else{
+       var date_temp = p_str_date.split('.');
+        var nMonth=parseFloat(date_temp[1])-1;
+       var ma_date = new Date(date_temp[2], nMonth, date_temp[0]);
+       if(ma_date.getFullYear()==date_temp[2] && ma_date.getMonth()==nMonth && 
ma_date.getDate()==date_temp[0]){
+           return true;
+       }
+       else{
+           return false;
+       }
+    }
+
+}
+/**
+ * @brief get the string in the id and check if the date is valid
+ * @parameter p_id_date is the id of the element to check
+ * @return true if the date is valid
+ * @see check_date
+ */
+function check_date_id(p_id_date)
+{
+       var str_date=$('check_date_id').value;
+       return check_date(str_date);
 }
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]