diff --git a/src/commands/CmdStop.cpp b/src/commands/CmdStop.cpp index 1ea36aa4..634699ae 100644 --- a/src/commands/CmdStop.cpp +++ b/src/commands/CmdStop.cpp @@ -48,9 +48,10 @@ int CmdStop ( Journal& journal) { const bool verbose = rules.getBoolean ("verbose"); + const Datetime now {}; + auto filter = cli.getFilter ({ now, 0 }); // Load the most recent interval. - auto filter = cli.getFilter (); auto latest = getLatestInterval (database); // Verify the interval is open. @@ -66,6 +67,15 @@ int CmdStop ( "Perhaps you want the modify command?."); } + if (! filter.is_started()) + { + throw std::string ("No datetime specified."); + } + else if (filter.start <= latest.start) + { + throw std::string ("The end of a date range must be after the start."); + } + journal.startTransaction (); Interval modified {latest};