Basic date compare fix
The date compare now uses correct preg_split for splitting with - and / as date separators
This commit is contained in:
@@ -158,6 +158,11 @@
|
|||||||
print $basic->magic_links('user@bubu.at').'<br>';
|
print $basic->magic_links('user@bubu.at').'<br>';
|
||||||
print $basic->magic_links('http://test.com/foo/bar.php?foo=1').'<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 error messages
|
||||||
print $basic->print_error_msg();
|
print $basic->print_error_msg();
|
||||||
|
|
||||||
|
|||||||
@@ -1239,8 +1239,8 @@
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// splits the data up with / or -
|
// splits the data up with / or -
|
||||||
list ($start_year, $start_month, $start_day) = explode('[/-]', $start_date);
|
list ($start_year, $start_month, $start_day) = preg_split('/[\/-]/', $start_date);
|
||||||
list ($end_year, $end_month, $end_day) = explode('[/-]', $end_date);
|
list ($end_year, $end_month, $end_day) = preg_split('/[\/-]/', $end_date);
|
||||||
// check that month & day are two digits and then combine
|
// check that month & day are two digits and then combine
|
||||||
foreach (array('start', 'end') as $prefix)
|
foreach (array('start', 'end') as $prefix)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user