From 0ee6cdb897722726e012e86aac443a47d291927f Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 10 Feb 2020 12:14:58 +0100 Subject: Improve formatting on list.php --- list.php | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'list.php') diff --git a/list.php b/list.php index 90e6084..3210aff 100644 --- a/list.php +++ b/list.php @@ -16,6 +16,20 @@ function htmlid ($str) return preg_replace ('/\W/','-',$str); } +function format_date_range ($start,$end) +{ + $dates=date ('D j',$start); + if (date ('Y',$start) != date ('Y',$end)) + $dates.=date (' M Y',$start).' to '.date ('j M',$end); + else if (date ('M',$start) != date ('M',$end)) + $dates.=date (' M',$start).' to '.date ('j M',$end); + else + $dates.='–'.date ('j M',$end); + if (date ('Y') != date ('Y',$end)) + $dates.=date (' Y',$end); + return $dates; +} + $selected_keywords=isset ($_GET['keywords']) ? explode(',',$_GET['keywords']) : null; $keywords=get_keywords(); @@ -48,14 +62,19 @@ if (isset ($_GET['keywords']) && count ($_GET['keywords']) != count ($keywords)) '; - echo '