diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/index.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/index.js b/js/index.js index 5d34903..0a41bf0 100644 --- a/js/index.js +++ b/js/index.js @@ -1,4 +1,7 @@ "use strict"; +const DATE_FORMAT = { + weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' +}; const LATITUDE = 43.26271; const LONGITUDE = -2.92528; const TIMEZONE = "Europe/Madrid"; @@ -76,7 +79,7 @@ function makeDay(date, t_max, t_min, weather){ day_element.setAttribute("class", "day-forecast"); day_element.innerHTML = ` <div class="day-forecast-text"> - <h2><time datetime="${date}">${(new Date(date)).toLocaleString()}</h2> + <h2><time datetime="${date}">${(new Date(date)).toLocaleDateString(undefined, DATE_FORMAT)}</h2> <p>${weather_desc}</p> <ul> <li>Max: ${t_max}C</li> |