|
|
|
@ -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;
|
|
|
|
|