Fixed a bug with 2 digit years

git-svn-id: file:///svn-source/pmgr/branches/v0.3_work/site@1003 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2011-01-08 01:26:04 +00:00
parent 381d14a6f6
commit 10f74d90ba

View File

@@ -952,7 +952,9 @@ class AppController extends Controller {
foreach ($searches AS &$search) {
if (preg_match('/(_date|stamp)$/', $search['field']) &&
preg_match('%(\d{1,2})[-/](\d{1,2})[-/](\d{2,4})%', $search['value'], $matches)) {
$search['value'] = sprintf('%04d%02d%02d', $matches[3], $matches[2], $matches[1]);
$search['value'] = sprintf('%04d%02d%02d',
$matches[3] + ($matches[3] < 50 ? 2000 : ($matches[3] < 100 ? 1900 : 0)),
$matches[2], $matches[1]);
}
}
unset($search);