summaryrefslogtreecommitdiff
path: root/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-06-08 15:19:11 +0200
committeremkael <emkael@tlen.pl>2016-06-10 11:46:41 +0200
commit6ab01ff111f2aca0786f4fd45df25ea6ad9be1ca (patch)
treeb8002a9239b2d4050bcc8ad48cccc39d56ffbe34 /lib/prado/framework/Web/UI/WebControls/TDatePicker.php
parent90d93b09640ef2026d4450e17f9e9c5fedb76c81 (diff)
* Prado upgraded to 3.3.1-rbd4929d
Diffstat (limited to 'lib/prado/framework/Web/UI/WebControls/TDatePicker.php')
-rw-r--r--lib/prado/framework/Web/UI/WebControls/TDatePicker.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/prado/framework/Web/UI/WebControls/TDatePicker.php b/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
index 7a164dd..a773c69 100644
--- a/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
+++ b/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
@@ -483,10 +483,19 @@ class TDatePicker extends TTextBox
{
$date = @getdate();
- if(isset($values[$key.'$day']))
+ $pattern = $this->getDateFormat();
+ $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
+
+ $order = $formatter->getDayMonthYearOrdering();
+
+ if(isset($values[$key.'$day'])) {
$day = intval($values[$key.'$day']);
- else
+ } elseif(in_array('day', $order)) {
$day = $date['mday'];
+ } else {
+ $day = 1;
+ }
if(isset($values[$key.'$month']))
$month = intval($values[$key.'$month']) + 1;
@@ -502,9 +511,6 @@ class TDatePicker extends TTextBox
$date = $s->getTimeStamp(0, 0, 0, $month, $day, $year);
//$date = @mktime(0, 0, 0, $month, $day, $year);
- $pattern = $this->getDateFormat();
- $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
- $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
return $formatter->format($date);
}