From 2df80aac01b088466a04fd6ffa8c9e33d94d80d9 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 24 Jan 2021 04:19:45 -0500 Subject: [PATCH] CmdCalendar: Default to current month if no due date is present Previously, if no due date was set on any pending/waiting task, the calendar output would start at the end of the currently supported date period. Default to current month instead. --- src/commands/CmdCalendar.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index e4dec6985..34cce6ff2 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -187,8 +187,12 @@ int CmdCalendar::execute (std::string& output) } } } - mFrom = oldest.month(); - yFrom = oldest.year(); + + // Default to current month if no due date is present + if (oldest != Datetime (9999, 12, 31)) { + mFrom = oldest.month(); + yFrom = oldest.year(); + } } if (Context::getContext ().config.getBoolean ("calendar.offset"))