diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_calendar.inc.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php index 9191bb157..73df86fbb 100644 --- a/include/functions_calendar.inc.php +++ b/include/functions_calendar.inc.php @@ -289,4 +289,24 @@ WHERE id IN (' . implode(',',$page['items']) .')'; } pwg_debug('end initialize_calendar'); } + +/* + * callback to sort array with date comparaison + * + **/ +function date_compare(&$a, &$b) +{ + $parts = explode('-', $a); + foreach ($parts as &$p) { + $p = (int)$p; + } + $a = implode('-', $parts); + $parts = explode('-', $b); + foreach ($parts as &$p) { + $p = (int)$p; + } + $b = implode('-', $parts); + + return strcmp($a, $b); +} ?>
\ No newline at end of file |