Skip to content

Commit

Permalink
v0.14.14 Release Candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
vasqued2 authored Dec 18, 2024
1 parent 2f1d0d6 commit d2af037
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 34 deletions.
76 changes: 56 additions & 20 deletions dist/ha-teamtracker-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ha-teamtracker-card.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/const.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export let VERSION = "v0.14.13";
export let VERSION = "v0.14.14";

export let GOLF_HEADSHOT_URL = "https://a.espncdn.com/i/headshots/golf/players/full/";
export let MMA_HEADSHOT_URL = "https://a.espncdn.com/i/headshots/mma/players/full/";
Expand Down
35 changes: 25 additions & 10 deletions src/set_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export function setCardFormat(o, c) {
}


export function setStartInfo(c, stateObj, t, lang, time_format) {
export function setStartInfo(c, stateObj, t, lang, time_format, server_time_zone) {

var gameDate = new Date(stateObj.attributes.date);
var gameDateStr = gameDate.toLocaleDateString(lang, { month: 'short', day: '2-digit' });
Expand Down Expand Up @@ -281,15 +281,30 @@ export function setStartInfo(c, stateObj, t, lang, time_format) {
c.gameDatePRE = gameDateStr;
}

c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit' });
if (time_format == "24") {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', hour12: false });
}
if (time_format == "12") {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', hour12: true });
if (server_time_zone) {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', timeZone: server_time_zone });
if (time_format == "24") {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', hour12: false, timeZone: server_time_zone });
}
if (time_format == "12") {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', hour12: true, timeZone: server_time_zone });
}
if (time_format == "system") {
var sys_lang = navigator.language || "en"
c.gameTime = gameDate.toLocaleTimeString(sys_lang, { hour: '2-digit', minute: '2-digit', timeZone: server_time_zone });
}
}
if (time_format == "system") {
var sys_lang = navigator.language || "en"
c.gameTime = gameDate.toLocaleTimeString(sys_lang, { hour: '2-digit', minute: '2-digit' });
else {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit' });
if (time_format == "24") {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', hour12: false });
}
if (time_format == "12") {
c.gameTime = gameDate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', hour12: true });
}
if (time_format == "system") {
var sys_lang = navigator.language || "en"
c.gameTime = gameDate.toLocaleTimeString(sys_lang, { hour: '2-digit', minute: '2-digit' });
}
}
}
10 changes: 8 additions & 2 deletions src/teamtracker_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,15 @@ export class TeamTrackerCard extends LitElement {
sport = "default";
}

var server_time_zone = null;
if (this.hass.locale.time_zone == "server") {
server_time_zone = this.hass.config.time_zone;
}
//
// Set card data
//
initCardData(c);
setStartInfo(c, stateObj, t, lang, time_format);
setStartInfo(c, stateObj, t, lang, time_format, server_time_zone);
setCardFormat(o, c);
setDefaults(t, lang, stateObj, c, o, sport, team, oppo);
setSportData(sport, t, stateObj, c, team, oppo)
Expand Down Expand Up @@ -165,7 +169,9 @@ export class TeamTrackerCard extends LitElement {
if (o.debug) {
var lastUpdate = new Date(stateObj.attributes.last_update);
var updateTime = lastUpdate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', second: '2-digit' });

if (server_time_zone) {
updateTime = lastUpdate.toLocaleTimeString(lang, { hour: '2-digit', minute: '2-digit', second: '2-digit', timeZone: server_time_zone });
}
c.title = this._config.entity + " " + c.title + "(";
if (stateObj.attributes.api_message) {
c.title = c.title + stateObj.attributes.api_message[0];
Expand Down

0 comments on commit d2af037

Please sign in to comment.