[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-cvs
Subject:    [SMARTY-CVS] cvs: smarty / NEWS  /libs/plugins function.html_select_date.php
From:       "Messju Mohr" <messju () php ! net>
Date:       2004-02-13 23:38:08
Message-ID: cvsmessju1076715488 () cvsserver
[Download RAW message or body]

messju		Fri Feb 13 18:38:08 2004 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs/plugins	function.html_select_date.php 
  Log:
  correctly handle partially empty dates (like "2004--" or "-12-").
  
  
  
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.435&r2=1.436&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.435 smarty/NEWS:1.436
--- smarty/NEWS:1.435	Thu Feb 12 06:28:49 2004
+++ smarty/NEWS	Fri Feb 13 18:38:07 2004
@@ -1,3 +1,5 @@
+  - fix allow empty years, months and days in html_select_date's
+    time-attribute (messju)
   - fix YES and NO should not be booleanized inside triple-quotes in a
     config-file (messju)
   - fix accidently slurped line following a triple-quoted value in a
http://cvs.php.net/diff.php/smarty/libs/plugins/function.html_select_date.php?r1=1.21&r2=1.22&ty=u
                
Index: smarty/libs/plugins/function.html_select_date.php
diff -u smarty/libs/plugins/function.html_select_date.php:1.21 \
                smarty/libs/plugins/function.html_select_date.php:1.22
--- smarty/libs/plugins/function.html_select_date.php:1.21	Wed Dec 17 05:45:57 2003
+++ smarty/libs/plugins/function.html_select_date.php	Fri Feb 13 18:38:08 2004
@@ -123,7 +123,7 @@
     }
 
     // If $time is not in format yyyy-mm-dd
-    if (!preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/', $time) && $time!='--') {
+    if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
         // then $time is empty or unix timestamp or mysql timestamp
         // using smarty_make_timestamp to get an unix timestamp and
         // strftime to make yyyy-mm-dd
@@ -160,8 +160,8 @@
             $month_values[''] = '';
         }
         for ($i = 1; $i <= 12; $i++) {
-            $month_names[] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
-            $month_values[] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, \
2000)); +            $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, \
1, 2000)); +            $month_values[$i] = strftime($month_value_format, mktime(0, \
0, 0, $i, 1, 2000));  }
 
         $month_result .= '<select name=';
@@ -183,7 +183,7 @@
 
         $month_result .= smarty_function_html_options(array('output'     => \
                $month_names,
                                                             'values'     => \
                $month_values,
-                                                            'selected'   => \
$month_values[$time[1]-1], +                                                          \
                'selected'   => $month_values[(int)$time[1]],
                                                             'print_result' => \
false),  $smarty);
 

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic