vscode-todo-plus
vscode-todo-plus copied to clipboard
Time statistic seems to be wrongly calculated
If I try this one...
Baz:
✔ Foo @started(21-11-26 10:12) @done(21-11-26 11:17) @lasted(1h5m21s)
✔ Bar @started(21-11-26 11:17) @done(21-11-26 11:18) @lasted(1m54s)
I see the following:
As you can see, it seems it is actually adding seconds to minutes and doing some miscalculation. Even more, it happens with just one item:
Thoughts?
Btw, latest version and config options I am using now:
"todo.archive.remove.emptyProjects": false,
"todo.statistics.project.enabled": "global.projects < 100",
"todo.statistics.project.text": "([pending]) [est] [lasted]",
Thanks!!
Yes, I just found this as well. I'm using v4.18.4 and it seems like when there are minutes after the hours and the minutes are less than 10, it drops the minutes in the summary. However, if you inject a zero before the minute, it calculates correctly...
in src/utils/time.ts:127 the result of the formating is "1h 5m21s". On line 149, toTime() returns a wrong value if its formatted this way, it's working fine with "1h 5m 21s" (note the additional blank space between 'm' and '2'). I don't know if its safe to change the regex - what do you mean @fabiospampinato?