mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Date Support
- Added Date::week helper method.
This commit is contained in:
parent
6555811ca5
commit
3a8a513d17
3 changed files with 24 additions and 1 deletions
16
src/Date.cpp
16
src/Date.cpp
|
@ -585,6 +585,12 @@ int Date::month () const
|
|||
return t->tm_mon + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::week () const
|
||||
{
|
||||
return Date::weekOfYear (Date::dayOfWeek (context.config.get ("weekstart")));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::day () const
|
||||
{
|
||||
|
@ -679,6 +685,16 @@ bool Date::sameDay (const Date& rhs) const
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::sameWeek (const Date& rhs) const
|
||||
{
|
||||
if (this->year () == rhs.year () &&
|
||||
this->week () == rhs.week ())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::sameMonth (const Date& rhs) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue