This commit is contained in:
Fred Tempez 2024-08-14 09:09:26 +02:00
parent f84bcbb878
commit ad15e8b827
2 changed files with 25 additions and 17 deletions

View File

@ -8,7 +8,7 @@ class helper
/** Filtres personnalisés */ /** Filtres personnalisés */
const FILTER_BOOLEAN = 1; const FILTER_BOOLEAN = 1;
const FILTER_DATETIME = 2; const FILTER_DATETIME = 2; // filtre pour le champ de formulaire A conserver pour la compatibilité
const FILTER_FLOAT = 3; const FILTER_FLOAT = 3;
const FILTER_ID = 4; const FILTER_ID = 4;
const FILTER_INT = 5; const FILTER_INT = 5;
@ -16,10 +16,13 @@ class helper
const FILTER_PASSWORD = 7; const FILTER_PASSWORD = 7;
const FILTER_STRING_LONG = 8; const FILTER_STRING_LONG = 8;
const FILTER_STRING_SHORT = 9; const FILTER_STRING_SHORT = 9;
const FILTER_TIMESTAMP = 10; const FILTER_TIMESTAMP = 10; // Saisie d'une date en locatime
const FILTER_URL = 11; const FILTER_URL = 11;
const FILTER_DATE = 12; const FILTER_DATE = 12; // filtre pour le champ de formulaire
const FILTER_TIME = 13; const FILTER_TIME = 13; // filtre pour le champ de formulair
const FILTER_MONTH = 14; // filtre pour le champ de formulair
const FILTER_YEAR = 16; // filtre pour le champ de formulair
@ -480,8 +483,13 @@ class helper
$text = date('Y-m-d', $text); $text = date('Y-m-d', $text);
break; break;
case self::FILTER_TIME: case self::FILTER_TIME:
$text = date('H:i:s', $text); $text = date('H:i', $text);
break; break;
case self::FILTER_MONTH:
$text = date('m', $text);
break;
case self::FILTER_YEAR:
$text = date('Y', $text);
} }
return $text; return $text;
} }

View File

@ -253,7 +253,7 @@ class template
// Filtre selon le type // Filtre selon le type
switch ($attributes['type']) { switch ($attributes['type']) {
case 'datetime-local': case 'datetime-local':
$filter = helper::FILTER_TIMESTAMP; $filter = helper::FILTER_DATETIME;
break; break;
case 'date': case 'date':
$filter = helper::FILTER_DATE; $filter = helper::FILTER_DATE;