Basic date compare fix

The date compare now uses correct preg_split for splitting with - and /
as date separators
This commit is contained in:
Clemens Schwaighofer
2017-04-03 17:52:49 +09:00
parent e1255e0872
commit 6606f30ceb
2 changed files with 7 additions and 2 deletions

View File

@@ -158,6 +158,11 @@
print $basic->magic_links('user@bubu.at').'<br>';
print $basic->magic_links('http://test.com/foo/bar.php?foo=1').'<br>';
// compare date
$date_1 = '2017/1/5';
$date_2 = '2017-01-05';
print "COMPARE DATE: ".$basic->CompareDate($date_1, $date_2)."<br>";
// print error messages
print $basic->print_error_msg();

View File

@@ -1239,8 +1239,8 @@
return FALSE;
// splits the data up with / or -
list ($start_year, $start_month, $start_day) = explode('[/-]', $start_date);
list ($end_year, $end_month, $end_day) = explode('[/-]', $end_date);
list ($start_year, $start_month, $start_day) = preg_split('/[\/-]/', $start_date);
list ($end_year, $end_month, $end_day) = preg_split('/[\/-]/', $end_date);
// check that month & day are two digits and then combine
foreach (array('start', 'end') as $prefix)
{