mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
helper: Fixed range for :lastmonth
This commit is contained in:
parent
b932746a9e
commit
4a34316626
1 changed files with 10 additions and 6 deletions
|
@ -153,15 +153,19 @@ bool expandIntervalHint (
|
||||||
{
|
{
|
||||||
Datetime now;
|
Datetime now;
|
||||||
int y = now.year ();
|
int y = now.year ();
|
||||||
int m = now.month () - 1;
|
int y_prev = y;
|
||||||
if (m == 0)
|
|
||||||
|
int m = now.month ();
|
||||||
|
int m_prev = m - 1;
|
||||||
|
|
||||||
|
if (m_prev == 0)
|
||||||
{
|
{
|
||||||
m = 12;
|
m_prev = 12;
|
||||||
--y;
|
--y_prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
range.start = Datetime (y, m, 1);
|
range.start = Datetime (y_prev, m_prev, 1);
|
||||||
range.end = Datetime (y, m, Datetime::daysInMonth (y, m));
|
range.end = Datetime (y, m, 1);
|
||||||
debug (format ("Hint {1} expanded to {2} - {3}",
|
debug (format ("Hint {1} expanded to {2} - {3}",
|
||||||
hint,
|
hint,
|
||||||
range.start.toISOLocalExtended (),
|
range.start.toISOLocalExtended (),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue