// Date Range picker improvements

This commit is contained in:
Jerome Nadaud
2013-10-17 11:39:02 +02:00
parent 6ed7ffc647
commit f9b115a2f8
5 changed files with 57 additions and 39 deletions
+2 -19
View File
@@ -26,7 +26,8 @@
class HelperCalendarCore extends Helper
{
const DEFAULT_DATE_FORMAT = 'Y-m-d';
const DEFAULT_DATE_FORMAT = 'Y-m-d';
const DEFAULT_COMPARE_OPTION = 1;
private $_actions;
private $_compare_actions;
@@ -81,41 +82,23 @@ class HelperCalendarCore extends Helper
public function setCompareDateFrom($value)
{
if (!isset($value) || $value == '')
$value = date('Y-m-d', strtotime("-31 days"));
if (!is_string($value))
throw new PrestaShopException('Date must be a string');
$this->_compare_date_from = $value;
return $this;
}
public function getCompareDateFrom()
{
if (!isset($this->_compare_date_from))
$this->_compare_date_from = date('Y-m-d', strtotime("-31 days"));
return $this->_compare_date_from;
}
public function setCompareDateTo($value)
{
if (!isset($value) || $value == '')
$value = date('Y-m-d');
if (!is_string($value))
throw new PrestaShopException('Date must be a string');
$this->_compare_date_to = $value;
return $this;
}
public function getCompareDateTo()
{
if (!isset($this->_compare_date_to))
$this->_compare_date_to = date('Y-m-d');
return $this->_compare_date_to;
}