wassy92x / lovelace-digital-clock

A custom digital clock card for Home Assistant
MIT License
96 stars 17 forks source link

12hr Display Mode #39

Closed NexGen-3D-Printing closed 4 months ago

NexGen-3D-Printing commented 8 months ago

First up, a quick thanks, this clock is 99% perfect, just the 12/24hr thing was bugging me and I seen nothing in the documentation on changing it, so I decided to mess about and figured it out.

Just in case anyone else is wondering, as every single clock I looked at for Home Assistant was using 24hr mode, the following will give you 12hr mode as wifes and kids dont understand 24hr clocks properly:

type: custom:digital-clock timeFormat: h:mm a dateFormat: weekday: long day: 2-digit month: short

This will display your clock like this:

Clock

kvoth1 commented 8 months ago

How do I set to 24 hour? It’s defaulting to 12 hour when using the sample code for me when I always use 24 hour. :)

Edit: figured it out timeformat: HH:mm

wassy92x commented 8 months ago

Firstly the displayed format is dependent on the locale. For example we in Germany (locale de) always dispay the time in 24hours format and for example in England (locale en) the default for a time is the 12h format. To set the locale either set the locale property in the card or set the correct locale in your home assistant profile. Another possibility is to set the format explicitly. In your case the property timeFormat has to be set to HH:mm