|
|
|
@ -798,7 +798,7 @@ class rcube_utils
|
|
|
|
|
$date = preg_replace(
|
|
|
|
|
array(
|
|
|
|
|
'/GMT\s*([+-][0-9]+)/', // support non-standard "GMTXXXX" literal
|
|
|
|
|
'/[^a-z0-9\x20\x09:+-\/]/i', // remove any invalid characters
|
|
|
|
|
'/[^a-z0-9\x20\x09:+-\/]/i', // remove any invalid characters
|
|
|
|
|
'/\s*(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s*/i', // remove weekday names
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
@ -810,15 +810,15 @@ class rcube_utils
|
|
|
|
|
$date = trim($date);
|
|
|
|
|
|
|
|
|
|
// try to fix dd/mm vs. mm/dd discrepancy, we can't do more here
|
|
|
|
|
if (preg_match('/^(\d{1,2})[.\/-](\d{1,2})[.\/-](\d{4})(.*)$/', $date, $m)) {
|
|
|
|
|
if (preg_match('/^(\d{1,2})[.\/-](\d{1,2})[.\/-](\d{4})(\s.*)?$/', $date, $m)) {
|
|
|
|
|
$mdy = $m[2] > 12 && $m[1] <= 12;
|
|
|
|
|
$day = $mdy ? $m[2] : $m[1];
|
|
|
|
|
$month = $mdy ? $m[1] : $m[2];
|
|
|
|
|
$date = sprintf('%04d-%02d-%02d%s', intval($m[3]), $month, $day, $m[4] ?: '00:00:00');
|
|
|
|
|
$date = sprintf('%04d-%02d-%02d%s', $m[3], $month, $day, $m[4] ?: ' 00:00:00');
|
|
|
|
|
}
|
|
|
|
|
// I've found that YYYY.MM.DD is recognized wrong, so here's a fix
|
|
|
|
|
else if (preg_match('/^(\d{4})\.(\d{1,2})\.(\d{1,2})(.*)$/', $date)) {
|
|
|
|
|
$date = str_replace('.', '-', $date) . ($m[4] ?: '00:00:00');
|
|
|
|
|
else if (preg_match('/^(\d{4})\.(\d{1,2})\.(\d{1,2})(\s.*)?$/', $date, $m)) {
|
|
|
|
|
$date = sprintf('%04d-%02d-%02d%s', $m[1], $m[2], $m[3], $m[4] ?: ' 00:00:00');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $date;
|
|
|
|
|