From c0114a0d004cf0c258f4767cbb0dbc4824b24c51 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 11 Sep 2022 13:13:05 +0200 Subject: show only day (not time) for whole-day events --- bin/events2md.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/events2md.pl b/bin/events2md.pl index 6d73768..4272291 100755 --- a/bin/events2md.pl +++ b/bin/events2md.pl @@ -213,12 +213,20 @@ sub resolve_event my $location = get_property_string( $entry, 'location' ); my $date_begin = $start->strftime('%A %e. %B'); my $time_begin = $start->strftime('%k.%M'); + my $date_end = $end->strftime('%A %e. %B'); my $time_end = $end->strftime('%k.%M'); - my $time_brief = ucfirst("$date_begin kl. $time_begin"); + my $datespan + = ( defined($end) and $date_end ne $date_begin ) + ? ucfirst("$date_begin - $date_end") + : ucfirst("$date_begin"); my $timespan - = $time_end + = ( defined($end) and not $_->all_day ) ? ucfirst("$date_begin kl. $time_begin-$time_end") : undef; + my $time_brief + = $_->all_day + ? $datespan + : ucfirst("$date_begin kl. $time_begin"); my @attachments; if ( $entry->property('attach') ) { -- cgit v1.2.3