diff options
author | wei <> | 2006-09-06 01:08:08 +0000 |
---|---|---|
committer | wei <> | 2006-09-06 01:08:08 +0000 |
commit | 5f35084526732b5e41abc2a0d8d4ddb3ca13a34b (patch) | |
tree | 2183e743ab851f37535bf66b685a05a573081e73 /framework/Web/UI/WebControls | |
parent | 8f1fa1c2bb6c2b7cbb493bd2038669b1e1a8ca7d (diff) |
Fixed dropdown list for day formatted as 'dd'
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 73a69abc..7654363c 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -600,7 +600,7 @@ class TDatePicker extends TTextBox */
protected function renderCalendarDayOptions($writer, $selected=null)
{
- $days = array(); for($i=1;$i<=31;$i++) $days[$i] = $i;
+ $days = $this->getDropDownDayOptions();
$writer->addAttribute('id', $this->getClientID().'_day');
$writer->addAttribute('name', $this->getUniqueID().'$day');
$writer->addAttribute('class', 'datepicker_day_options');
@@ -612,13 +612,28 @@ class TDatePicker extends TTextBox }
/**
+ * @return array list of day options for a drop down list.
+ */
+ protected function getDropDownDayOptions()
+ {
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter',
+ $this->getDateFormat());
+ $days = array();
+ $requiresPadding = $formatter->getDayPattern() === 'dd';
+ for($i=1;$i<=31;$i++)
+ {
+ $days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i;
+ }
+ return $days;
+ }
+
+ /**
* Renders the month drop down list options.
* @param THtmlWriter the writer used for the rendering purpose
* @param mixed selected month.
*/
protected function renderCalendarMonthOptions($writer, $selected=null)
{
-
$info = $this->getLocalizedCalendarInfo();
$writer->addAttribute('id', $this->getClientID().'_month');
$writer->addAttribute('name', $this->getUniqueID().'$month');
|