r-renato / ha-card-weather-conditions

Weather condition card (Lovelace) for Home Assistant.
MIT License
194 stars 37 forks source link

Cut seconds out of sunset timestamps? #14

Open bsrdjan opened 4 years ago

bsrdjan commented 4 years ago

Thank you very much for this weather card.

Would it make sense to trim seconds out sunrise/sunset timestamps, by default or configuraton options, like:

${void 0!==c?Ae(c.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}),"","mdi:weather-sunset-up"):""}
${void 0!==d?Ae(d.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}),"","mdi:weather-sunset-down"):""}
bsrdjan commented 4 years ago

Only in my mobile app, the sun rising/setting times are shown in a format incompatible with sr-latn language setting: time

In desktop browser looks correct:

Screenshot 2020-05-24 at 13 48 30

Could the locale language be missing here ? If added, together with format, could fix seconds as well:

ha-cwc-render-present.ts

${undefined !== next_rising ? _renderPresentSingle(
  next_rising.toLocaleTimeString(), '', 'mdi:weather-sunset-up') : ""}               
${undefined !== next_setting ? _renderPresentSingle(
  next_setting.toLocaleTimeString(), '', 'mdi:weather-sunset-down') : ""}           
r-renato commented 4 years ago

thank you for your report. I have released a new version to fix this issue. I will consider handling the date format in a future version.

Thank you. Renato

magtimmermans commented 3 years ago

Hi,

First of all, thanks for your great card!

I have the same issue with the seconds. I have the latest release as far as I know.

Could you please re-check?

Thanks!