timer-bar-card icon indicating copy to clipboard operation
timer-bar-card copied to clipboard

Render negative times

Open SLaks opened this issue 1 year ago • 2 comments

This is particularly important for timers like Google Home that don'stay while ringing until explicitly dismissed; this lets me see how long the timer was ringing for.

I did not verify that all of the rounding behaves correctly.

SLaks avatar Apr 25 '24 21:04 SLaks

Interesting! I hadn't even noticed, but you snuck in the ability to render negative times with the state: { fixed }. Thanks for fixing up this hidden feature.

I took a look at the rounding and it is inconsistent. h, m, and s all round down to smaller magnitude times. Meanwhile, hms and hm round up. I think rounding down here is the correct behavior, so that if you're rounding a timer that's run 1 second over to the nearest hour, you get a 0 instead of the timer immediately jumping to -1 once it's finished.

In terms of implementation, you should be able to leave the hmsTime and hmTime alone, and instead patch joinWithColons to handle the negatives.

rianadon avatar Apr 26 '24 02:04 rianadon

I didn't actually realize that negative times weren't previously possible; I just noticed the incorrect behavior in my dashboard.

Fixed.

SLaks avatar Apr 26 '24 15:04 SLaks

Ah; I see what you mean now.

How's this?

I noticed some more issues and added more test coverage.

SLaks avatar May 05 '24 17:05 SLaks

Looks perfect! Thanks so much for bearing with all the reviews and adding those additional tests.

Things are busy this week but I'll try to get a new release with these changes included next weekend.

rianadon avatar May 05 '24 18:05 rianadon