From 224a78120bddc0d14200a30e03fc8091c45cc99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 7 Feb 2026 18:17:07 +0100 Subject: [PATCH] add 'current-date' attribute to events When printing multi-day events through 'khal list --json', each day gets its own entry. However there is no indication which event belongs to which day. The user would manually need to recalculate it. Add a new attribute which references the specific day of a multi-day event that is printed. --- khal/khalendar/event.py | 2 ++ khal/utils.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/khal/khalendar/event.py b/khal/khalendar/event.py index 3af1531cd..45782fb6f 100644 --- a/khal/khalendar/event.py +++ b/khal/khalendar/event.py @@ -645,6 +645,8 @@ def attributes( attributes["end-date-long"] = self.end_local.strftime(self._locale['longdateformat']) attributes["end-time"] = self.end_local.strftime(self._locale['timeformat']) + attributes["current-date"] = relative_to_start.strftime(self._locale['dateformat']) + attributes["duration"] = timedelta2str(self.duration) # should only have time attributes at this point (start/end) diff --git a/khal/utils.py b/khal/utils.py index 4e7d4e70f..b113f6a63 100644 --- a/khal/utils.py +++ b/khal/utils.py @@ -221,7 +221,8 @@ def fmt(rows): 'start-style', 'end-style', 'to-style', 'start-end-time-style', 'end-necessary', 'end-necessary-long', 'repeat-symbol', 'repeat-pattern', 'title', 'organizer', 'description', 'location', 'all-day', 'categories', - 'uid', 'url', 'calendar', 'calendar-color', 'status', 'cancelled'] + 'uid', 'url', 'calendar', 'calendar-color', 'status', 'cancelled', + 'current-date'] def json_formatter(fields):