Skip to content

Commit 186c3d2

Browse files
committed
CmdStart: Allow tracking time in the future
Signed-off-by: Shaun Ruffell <[email protected]>
1 parent c009f0f commit 186c3d2

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/commands/CmdStart.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ int CmdStart (
4040

4141
auto interval = cli.getFilter ({now, 0});
4242

43-
if (interval.start > now)
44-
{
45-
throw std::string ("Time tracking cannot be set in the future.");
46-
}
47-
else if (!interval.is_started () || interval.is_ended ())
43+
if (!interval.is_started () || interval.is_ended ())
4844
{
4945
throw std::string ("The start command does not accept ranges but only a single datetime. "
5046
"Perhaps you want the track command?.");

test/start.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class TestStart(TestCase):
7272

7373
one_hour_after_utc = now_utc + timedelta(hours=1)
7474

75-
code, out, err = self.t.runError("start {:%Y-%m-%dT%H:%M:%S}Z FOO".format(one_hour_after_utc))
75+
code, out, err = self.t("start {:%Y-%m-%dT%H:%M:%S}Z FOO".format(one_hour_after_utc))
7676

77-
self.assertIn("Time tracking cannot be set in the future.", err)
77+
self.assertIn("Will start tracking", out)
7878

7979
def test_start_with_open_interval(self):
8080
"""Test start with already open interval, which should be auto-stopped"""

0 commit comments

Comments
 (0)