diff options
author | Jonas Smedegaard <dr@jones.dk> | 2023-08-13 11:34:07 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-08-27 23:39:36 +0200 |
commit | a2a6fd1ac47decc42f21a4a27702640dbd5287d5 (patch) | |
tree | f96b82ce73d5c435bc7223b7f1505c9fbda0dc85 | |
parent | 35ee391141bcb40e1eb29a132b593561178cca17 (diff) |
handle event without end time
-rwxr-xr-x | bin/events2md.pl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bin/events2md.pl b/bin/events2md.pl index c758577..9c10ce0 100755 --- a/bin/events2md.pl +++ b/bin/events2md.pl @@ -171,9 +171,14 @@ sub print_event } } my $location = get_property_string( $entry, 'location' ); - my $time_begin = ucfirst( $start->strftime('%A') ); - $time_begin .= $start->strftime(' %e. %B kl. %k.%M'); - my $time_end = $end->strftime('%k.%M'); + my $date_begin = $start->strftime('%A %e. %B'); + my $time_begin = $start->strftime('%k.%M'); + my $time_end = $end->strftime('%k.%M'); + my $time_brief = ucfirst("$date_begin kl. $time_begin"); + my $timespan + = $time_end + ? ucfirst("$date_begin kl. $time_begin-$time_end") + : undef; my %attachments; if ( $entry->property('attach') ) { for ( @{ $entry->property('attach') } ) { @@ -185,7 +190,7 @@ sub print_event } } - $_ = "### $time_begin."; + $_ = "### $time_brief."; $_ .= " $summary" if $summary; $_ .= "\n$description"; @@ -193,8 +198,8 @@ sub print_event if @attendees; $_ .= " \n**Mødested:** $location" if $location; - $_ .= " \n**Tid:** ${time_begin}-${time_end}." - if $time_begin and $time_end; + $_ .= " \n**Tid:** $timespan." + if $timespan; $_ .= " \n**Pris:** $price" if $price; $_ .= " \n[Køb billet på Billetto]($attachments{'billetto.dk'}[0])" |