Validation messages are improved for invalid date selection of the dates from calendar in admin dashboard

This commit is contained in:
Sumit Panwar
2024-05-28 16:09:32 +05:30
parent 572ab9c2d5
commit 00c4deb9ff

View File

@@ -295,9 +295,12 @@ class AdminDashboardControllerCore extends AdminController
public function postProcess()
{
if (Tools::isSubmit('submitDateRange')) {
if (!Validate::isDate(Tools::getValue('date_from'))
|| !Validate::isDate(Tools::getValue('date_to'))) {
if (!Validate::isDate(Tools::getValue('date_from')) && !Validate::isDate(Tools::getValue('date_to'))) {
$this->errors[] = Tools::displayError('The selected date range is not valid.');
} elseif (!Validate::isDate(Tools::getValue('date_from'))) {
$this->errors[] = Tools::displayError('Date from in not selected. Please select a date range from the calendar.');
} elseif (!Validate::isDate(Tools::getValue('date_to'))) {
$this->errors[] = Tools::displayError('Date to in not selected. Please select a date range from the calendar.');
}
if (Tools::getValue('datepicker_compare')) {