summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-05-31 18:06:53 +0200
committerFabio Bas <ctrlaltca@gmail.com>2016-05-31 18:06:53 +0200
commitbd4929d6eace0b55e35a37dbbc0f43cbedc9f1ea (patch)
treeb05cc9a193edaed4b9654a4fe3b0b0b861ed403f
parentd129b1eed574cec2276d6cefe9261ed6b2c7ddac (diff)
Fix #597
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php16
2 files changed, 12 insertions, 5 deletions
diff --git a/HISTORY b/HISTORY
index 8482c526..58a6054a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,7 @@ Version 3.3.2 xxx, 2016
BUG: Issue #592 - Fix TActiveMultiView brokwn on 3.3.1 (ctrlaltca)
BUG: Issue #588 - Fix reading values of controls inside TJuiDialog (ctrlaltca)
+BUG: Issue #597 - TDatePicker::getDateFromPostData selected month issue (Sachat)
ENH: Issue #591 - Support for hyphenated attributes via <prop:*></prop:*> template syntax (emkael)
ENH: Issue #594 - Added ability to check for subcontrols using isset(), empty() (jojoinside)
ENH: Allow TStyle behaviors (LCSKJ)
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 7a164ddb..a773c69c 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/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);
}