Skip to content

Commit

Permalink
Fixed Varien_Data_Form_Filter_Date::inputFilter() and Varien_Data_For…
Browse files Browse the repository at this point in the history
…m_Filter_Datetime::inputFilter() dealing with empty values (#3752)
  • Loading branch information
massa-man authored Jan 27, 2024
1 parent 95f94bf commit ecdf1e1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,15 @@
"contributions": [
"code"
]
},
{
"login": "massa-man",
"name": "Marcos Steverlynck",
"avatar_url": "https://avatars.githubusercontent.com/u/26821235?v=4",
"profile": "https://www.riseart.com/",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/seifer7"><img src="https://avatars.githubusercontent.com/u/13601073?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>Kane</b></sub></a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Sdfendor"><img src="https://avatars.githubusercontent.com/u/2728018?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>Kevin Jakob</b></sub></a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/leissbua"><img src="https://avatars.githubusercontent.com/u/68073221?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>leissbua</b></sub></a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.riseart.com/"><img src="https://avatars.githubusercontent.com/u/26821235?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>Marcos Steverlynck</b></sub></a></td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 8 additions & 0 deletions lib/Varien/Data/Form/Filter/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public function __construct($format = null, $locale = null)
*/
public function inputFilter($value)
{
if ($value === null || $value === '') {
return $value;
}

$filterInput = new Zend_Filter_LocalizedToNormalized([
'date_format' => $this->_dateFormat,
'locale' => $this->_locale
Expand All @@ -80,6 +84,10 @@ public function inputFilter($value)
*/
public function outputFilter($value)
{
if ($value === null || $value === '') {
return $value;
}

$filterInput = new Zend_Filter_LocalizedToNormalized([
'date_format' => Varien_Date::DATE_INTERNAL_FORMAT,
'locale' => $this->_locale
Expand Down
8 changes: 8 additions & 0 deletions lib/Varien/Data/Form/Filter/Datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class Varien_Data_Form_Filter_Datetime extends Varien_Data_Form_Filter_Date
*/
public function inputFilter($value)
{
if ($value === null || $value === '') {
return $value;
}

$filterInput = new Zend_Filter_LocalizedToNormalized([
'date_format' => $this->_dateFormat,
'locale' => $this->_locale
Expand All @@ -51,6 +55,10 @@ public function inputFilter($value)
*/
public function outputFilter($value)
{
if ($value === null || $value === '') {
return $value;
}

$filterInput = new Zend_Filter_LocalizedToNormalized([
'date_format' => Varien_Date::DATETIME_INTERNAL_FORMAT,
'locale' => $this->_locale
Expand Down

0 comments on commit ecdf1e1

Please sign in to comment.