vscode-todo-plus icon indicating copy to clipboard operation
vscode-todo-plus copied to clipboard

Time statistic seems to be wrongly calculated

Open damianavila opened this issue 3 years ago • 2 comments

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:

Screen Shot 2021-11-26 at 11 21 02

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:

Screen Shot 2021-11-26 at 11 25 38

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!!

damianavila avatar Nov 26 '21 14:11 damianavila

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...

image

greg-double avatar Dec 02 '21 19:12 greg-double

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?

Sn0bli avatar Dec 08 '22 15:12 Sn0bli