html_select_date [NEW_PATCH]
| From: | Nicklas Bondesson | Date: | Tue, 05 Jul 2005 10:05:01 +0000 |
| Subject: | html_select_date [NEW_PATCH] | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-2737@lists.php.net to get a copy of this message | ||
Here's a new patch that works with the time attribute. If you provide a
variable with an empty value it defaults back to current time.
Nicklas
--- function.html_select_date.php.orig 2005-07-05 12:08:43.000000000 +0200 +++ function.html_select_date.php 2005-07-05 12:09:23.000000000 +0200 @@ -124,6 +124,12 @@ } } + // Check for empty time attribute + // If empty, default back to current time + if (!preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $time)) { + $time = time(); + } + if(preg_match('!^-\d+$!',$time)) { // negative timestamp, use date() $time = date('Y-m-d',$time);
--- function.html_select_date.php.orig 2005-07-05 12:08:43.000000000 +0200 +++ function.html_select_date.php 2005-07-05 12:09:23.000000000 +0200 @@ -124,6 +124,12 @@ } } + // Check for empty time attribute + // If empty, default back to current time + if (!preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $time)) { + $time = time(); + } + if(preg_match('!^-\d+$!',$time)) { // negative timestamp, use date() $time = date('Y-m-d',$time);