dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
679 stars 75 forks source link

`timetrace status`: Display break time without seconds #105

Closed dominikbraun closed 3 years ago

dominikbraun commented 3 years ago

At the moment, the break time displayed on timetrace status includes seconds:

+-------------------+----------------------+----------------+--------------+
|  CURRENT PROJECT  |  WORKED SINCE START  |  WORKED TODAY  |    BREAKS    |
+-------------------+----------------------+----------------+--------------+
| web-store         | 0h 30min             | 0h 30min       | 0h 0min 0sec |
+-------------------+----------------------+----------------+--------------+

Since timetrace doesn't deal with seconds at least from a user perspective, the output here should be 0h 0min instead.

There's probably a way to format this using the Formatter type. You can get a ready-to-use instance using Timetrace.Formatter().

dhanushsr commented 3 years ago

Hey, I would like to contribute to this. Can you please assign this to me.

dhanushsr commented 3 years ago

@dominikbraun I have a doubt regarding the implementation. As I can see from the code, a common method formatDuration is used for format duration, which is used for all todayTime, currentTime and breakTime. So should this be just for break time or for all of them?

dominikbraun commented 3 years ago

To be honest, I'm not sure why the output is different even though the same function is being used 🤣 The output should just always be 2h 20m, not 2h 20m 20sec - I don't really mind about how you achieve this. You may change the output of breakTime or all of them if necessary.

dhanushsr commented 3 years ago

Sure thanks. :) The logic is if hours and minutes are zero then show 0hr 0min x seconds else show just hours mins . I will just remove the use of seconds all together.