From 630a1530e0e0495f602ec5b687630b54945b2882 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 30 May 2016 14:11:07 -0400 Subject: [PATCH] Task: Added QUARTER virtual tag --- src/Task.cpp | 20 ++++++++++++++++++++ src/Task.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/Task.cpp b/src/Task.cpp index 0e8cbf9bc..bfa1f8214 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -474,6 +474,25 @@ bool Task::is_duemonth () const return false; } +//////////////////////////////////////////////////////////////////////////////// +bool Task::is_duequarter () const +{ + if (has ("due")) + { + Task::status status = getStatus (); + + if (status != Task::completed && + status != Task::deleted) + { + ISO8601d due (get_date ("due")); + if (due.sameQuarter (ISO8601d ())) + return true; + } + } + + return false; +} + //////////////////////////////////////////////////////////////////////////////// bool Task::is_dueyear () const { @@ -1235,6 +1254,7 @@ bool Task::hasTag (const std::string& tag) const if (tag == "OVERDUE") return is_overdue (); if (tag == "WEEK") return is_dueweek (); if (tag == "MONTH") return is_duemonth (); + if (tag == "QUARTER") return is_duequarter (); if (tag == "YEAR") return is_dueyear (); #endif if (tag == "ACTIVE") return has ("start"); diff --git a/src/Task.h b/src/Task.h index 474049179..b4cf6d336 100644 --- a/src/Task.h +++ b/src/Task.h @@ -107,6 +107,7 @@ public: bool is_duetomorrow () const; bool is_dueweek () const; bool is_duemonth () const; + bool is_duequarter () const; bool is_dueyear () const; bool is_overdue () const; bool is_udaPresent () const;