Skip to content

Commit

Permalink
improve date handling
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Nov 3, 2023
1 parent fce96a9 commit f76ce18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/euskalmet.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ class Euskalmet extends HTMLElement {
let div = document.createElement('div');
let forecastText = item.weather.nameByLang[this.language];
div.className = 'euskalmet-forecast-day';
const dateText = item.date.split('T')[0];
const shortText = this.shortText ? forecastText : '';

const imageUrl = this.customBaseUrl
let dateObject = new Date(item.date);
let dateText = `${dateObject.getFullYear()}-${dateObject.getMonth()}-${dateObject.getDate()}`;
let shortText = this.shortText ? forecastText : '';

let imageUrl = this.customBaseUrl
? this.customIconExtension
? `${this.customBaseUrl}/${item.weather.id}.${this.customIconExtension}`
: `${this.customBaseUrl}/${item.weather.icon_name}`
Expand Down

0 comments on commit f76ce18

Please sign in to comment.