diff options
-rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 19 | ||||
-rw-r--r-- | tests/FunctionalTests/tickets/protected/pages/Ticket351.page | 2 |
2 files changed, 18 insertions, 3 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');
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket351.page b/tests/FunctionalTests/tickets/protected/pages/Ticket351.page index 78a7488d..bc148545 100644 --- a/tests/FunctionalTests/tickets/protected/pages/Ticket351.page +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket351.page @@ -1,6 +1,6 @@ <com:TContent ID="Content">
<com:TDatePicker ID="Birthdate"
- DateFormat="MMM/d/yyyy"
+ DateFormat="MMM/dd/yyyy"
TimeStamp="-2000000000"
FromYear="1900" UpToYear="1990" InputMode="DropDownList" />
|