From e9697044bcc2beb680e007439cc1e5916a3df925 Mon Sep 17 00:00:00 2001 From: bruno Date: Wed, 14 Jun 2023 07:32:22 -0400 Subject: [PATCH] =?UTF-8?q?An=C3=A1lise=20de=20datas.=20O=20formato=20pode?= =?UTF-8?q?=20serser=20dd/mm/yyyy=20hh:mm=20O=20resultado=20strlen=20ser?= =?UTF-8?q?=C3=A1=20acima=20de=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/util/util.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/util/util.php b/include/util/util.php index 806012e6..ef72b6b4 100644 --- a/include/util/util.php +++ b/include/util/util.php @@ -143,14 +143,25 @@ function contains_phone_number($string) { return(false); } + +/* + * dd/mm/yyyy + * dd/mm/yyyy HH:mm + */ function is_date($date) { - if (strlen($date) != 10) + /* É chamada também com esse formato + * dd/mm/yyyy HH:mm + * Portanto precisa ser mantido o < 10 + * 10 verifica se tem o mínimo para procurar + */ + + if (strlen($date) < 10) return(False); else { // Check if the date is valid $dt = preg_split('~/~', $date); - return(checkdate($dt[1], $dt[0], $dt[2])); + return(checkdate((int)$dt[1], (int)$dt[0], (int)$dt[2])); } }