summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-08-13 11:34:07 +0200
committerJonas Smedegaard <dr@jones.dk>2024-03-10 09:17:24 +0100
commit07d4c01652c3b3f72205e552e8dd8d543942e72b (patch)
tree24c70739285e29eb5d1994a9dc4c3d4f92ab76ea
parente1a3df0ad2024ac5bb02a6b1137f71b5c7038c92 (diff)
handle event without end time
-rwxr-xr-xbin/events2md.pl17
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])"