Changeset 3014
- Timestamp:
- 12/11/06 13:44:04 (2 years ago)
- Files:
-
- trunk/lib/helper/FormHelper.php (modified) (4 diffs)
- trunk/lib/i18n/sfDateFormat.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/helper/FormHelper.php
r3012 r3014 745 745 } 746 746 747 if ( _get_option($options, 'withtime', false))747 if ($withTime = _get_option($options, 'withtime', false)) 748 748 { 749 749 $pattern = 'g'; … … 779 779 780 780 // date format 781 $dateFormatInfo = sfDateTimeFormatInfo::getInstance($culture);782 $date_format = strtolower($dateFormatInfo->getShortDatePattern());781 $dateFormatInfo = new sfDateFormat($culture); 782 $date_format = $dateFormatInfo->getPattern($pattern); 783 783 784 784 // calendar date format 785 $calendar_date_format = $date_format; 786 $calendar_date_format = strtr($calendar_date_format, array('M' => 'm', 'y' => 'Y')); 787 $calendar_date_format = preg_replace('/([mdy])+/i', '%\\1', $calendar_date_format); 785 $calendar_date_format = $date_format;error_log($date_format); 786 $calendar_date_format = strtr($date_format, array('MM' => 'm', 'M'=>'m', 'dd'=>'d', 'yyyy' => 'Y', 'HH'=>'H', 'h'=>'l', 'mm'=>'M', 'ss'=>'S', 'a'=>'p')); 787 788 $calendar_date_format = preg_replace('/([mdyhlsp])+/i', '%\\1', $calendar_date_format); 789 error_log($calendar_date_format); 788 790 789 791 $id_inputField = (isset($options['id']))? $options['id'] : get_id_from_name($name); … … 794 796 inputField : "'.$id_inputField.'", 795 797 ifFormat : "'.$calendar_date_format.'", 798 daFormat : "'.$calendar_date_format.'", 796 799 button : "'.$id_calendarButton.'"'; 800 801 if ($withTime) 802 { 803 $js .= ",\n showsTime : true"; 804 } 797 805 798 806 // calendar options … … 823 831 if (!isset($options['size'])) 824 832 { 825 $options['size'] = 11; 833 // educated guess about the size 834 $options['size'] = strlen($date_format)+2; 826 835 } 827 836 $html = input_tag($name, $value, $options); trunk/lib/i18n/sfDateFormat.class.php
r2834 r3014 190 190 * @see DateTimeFormatInfo::formatDateTime() 191 191 */ 192 p rotectedfunction getPattern($pattern)192 public function getPattern($pattern) 193 193 { 194 194 if (is_array($pattern) && count($pattern) == 2)