mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Throw error message if start date is earlier than open interval
Closes #240 Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
parent
a62ebf0196
commit
57f9982fd1
2 changed files with 25 additions and 1 deletions
|
@ -35,7 +35,6 @@ int CmdStart (
|
|||
Database& database,
|
||||
Journal& journal)
|
||||
{
|
||||
// Add a new open interval, which may have a defined start time.
|
||||
auto filter = getFilter (cli);
|
||||
|
||||
auto now = Datetime ();
|
||||
|
@ -63,9 +62,18 @@ int CmdStart (
|
|||
// Stop it, at the given start time, if applicable.
|
||||
Interval modified {latest};
|
||||
if (filter.start.toEpoch () != 0)
|
||||
{
|
||||
if (modified.start >= filter.start)
|
||||
{
|
||||
throw std::string ("The end of a date range must be after the start.");
|
||||
}
|
||||
|
||||
modified.end = filter.start;
|
||||
}
|
||||
else
|
||||
{
|
||||
modified.end = Datetime ();
|
||||
}
|
||||
|
||||
// Update database.
|
||||
database.deleteInterval (latest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue