fufar / simple-clock-card

Simple clock card for Home assistant lovelace
49 stars 23 forks source link

use_military does not show leading zeros. #27

Closed GeekDoc closed 1 year ago

GeekDoc commented 1 year ago

The 24-hour format option works fine, but I was expecting military time, which always has two digits for the hour (e.g. "09:00"). Could a leading zero option be added?

GeekDoc commented 1 year ago

I haven't done any coding for HA, but it looks like changing line 44 to: let time_str = (use_military ? addZero(h) : ((h + 11) % 12) + 1 ) + would always add the zero. Adding the option would obviously take a bit more. If I get some time to figure this out, I'll do a PR.

GeekDoc commented 1 year ago

Submitted pull request.

fufar commented 1 year ago

merged in v1.7 @GeekDoc