aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2022-09-11 13:13:05 +0200
committerJonas Smedegaard <dr@jones.dk>2024-08-28 00:42:18 +0200
commitc0114a0d004cf0c258f4767cbb0dbc4824b24c51 (patch)
treeeaafea1d9a4dca870195d9ac31876553245c8f74
parentb08609649a576ba82d34384110373ac4804f0231 (diff)
show only day (not time) for whole-day events
-rwxr-xr-xbin/events2md.pl12
1 files 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') ) {