diff options
author | Ekaitz <ekaitz@elenq.tech> | 2023-01-30 11:54:33 +0100 |
---|---|---|
committer | Ekaitz <ekaitz@elenq.tech> | 2023-01-30 11:57:43 +0100 |
commit | c6b3f66f4b672ace094728b0d4f4b043faf785e4 (patch) | |
tree | 42533aa3efccf6a8ac9d1d95cbf55e0d149da84a /js | |
parent | 89ed26b8399441a5f3543a3cda4ea580318a9f8c (diff) |
Adjust date format to locale
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> |