Skip to content

Commit

Permalink
Update hasl-departure-card.js
Browse files Browse the repository at this point in the history
[#12](#12) Only show "Last updated" info if it was updated longer than x minutes ago
  • Loading branch information
DSorlov committed Sep 10, 2022
1 parent 59ca1ad commit 04b3ba4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dist/hasl-departure-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class HASLDepartureCard extends HTMLElement {
this.config.compact ? this.config.compact = false : this.config.compact = this.config.compact;
if (!this.config.offset) this.config.offset = 0;
if (!this.config.replace) this.config.replace = {};
if (!this.config.updated_minutes) this.config.updated_minutes = 0;
}

set hass(hass) {
Expand Down Expand Up @@ -225,6 +226,7 @@ class HASLDepartureCard extends HTMLElement {

// Updated
if (config.updated === true) {
if (this.config.updated_minutes==0 || this.config.updated_minutes < minutesSinceUpdate )

This comment has been minimized.

Copy link
@vishalg

vishalg Sep 17, 2022

The fix has broken the card completed - this object is not valid in this context and you can reference config object directly. i.e if (config.updated_minutes==0 || config.updated_minutes < minutesSinceUpdate )

html += `<table><tr>
<td class="last-update"><sub><i>${lang[culture].last_updated} ${updatedValue}</i></sub></td>
</tr></table>`;
Expand Down

0 comments on commit 04b3ba4

Please sign in to comment.