From 5220f3aab912408cb067f370ac1e1778cf401e82 Mon Sep 17 00:00:00 2001 From: Julian_phronesys Date: Fri, 19 Jan 2024 13:49:13 +0100 Subject: [PATCH] added validateDate() function --- src/Datatable/Datatable.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Datatable/Datatable.php b/src/Datatable/Datatable.php index 603f2a5..7c8a13d 100644 --- a/src/Datatable/Datatable.php +++ b/src/Datatable/Datatable.php @@ -339,6 +339,12 @@ class Datatable }); dt.css(:tableCss); + + function validateDate(text) { + text = text.replaceAll("/","-"); + var re = /^(\d{4}(-)\d{2}(-)\d{2}|\d{2}(-)\d{2}(-)\d{4})$/; + return re.test(text); + } }); DATATABLE_CONFIGURATION;