Skip to content

Commit 08f3eb6

Browse files
committed
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.
1 parent 0e76dbc commit 08f3eb6

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

khal/khalendar/event.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ def attributes(
645645
attributes["end-date-long"] = self.end_local.strftime(self._locale['longdateformat'])
646646
attributes["end-time"] = self.end_local.strftime(self._locale['timeformat'])
647647

648+
attributes["current-date"] = relative_to_start.strftime(self._locale['dateformat'])
649+
648650
attributes["duration"] = timedelta2str(self.duration)
649651

650652
# should only have time attributes at this point (start/end)

khal/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def fmt(rows):
221221
'start-style', 'end-style', 'to-style', 'start-end-time-style',
222222
'end-necessary', 'end-necessary-long', 'repeat-symbol', 'repeat-pattern',
223223
'title', 'organizer', 'description', 'location', 'all-day', 'categories',
224-
'uid', 'url', 'calendar', 'calendar-color', 'status', 'cancelled']
224+
'uid', 'url', 'calendar', 'calendar-color', 'status', 'cancelled', 'current-date']
225225

226226

227227
def json_formatter(fields):

0 commit comments

Comments
 (0)