mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Dates
- Added Date::startof{Day,Week,Month,Year} methods to facilitate the history, ghistory and burndown charts.
This commit is contained in:
parent
891136788f
commit
125058093f
3 changed files with 40 additions and 1 deletions
26
src/Date.cpp
26
src/Date.cpp
|
@ -460,6 +460,32 @@ const std::string Date::toString (const std::string& format /*= "m/d/Y" */) cons
|
|||
return formatted;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::startOfDay () const
|
||||
{
|
||||
return Date (month (), day (), year ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::startOfWeek () const
|
||||
{
|
||||
Date sow (mT);
|
||||
sow -= (dayOfWeek () * 86400);
|
||||
return Date (sow.month (), sow.day (), sow.year ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::startOfMonth () const
|
||||
{
|
||||
return Date (month (), 1, year ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::startOfYear () const
|
||||
{
|
||||
return Date (1, 1, year ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::valid (const std::string& input, const std::string& format)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue