Explorar el Código

Update the date issues.

Lee Morgan hace 6 meses
padre
commit
8dd341e0f4
Se han modificado 2 ficheros con 2 adiciones y 1 borrados
  1. 0 0
      index.html
  2. 2 1
      index.js

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
index.html


+ 2 - 1
index.js

@@ -18,7 +18,8 @@ const renderForecast = (f)=>{
     const tbody = document.getElementById("forecastBody");
 
     for(let i = 0; i < f.length; i++){
-        let date = new Date(f[i].date);
+        const [y, m, d] = f[i].date.split("-").map(Number);
+        const date = new Date(y, m-1, d);
         head.children[i+1].textContent = date.toLocaleDateString("en-US", {
             month: "short",
             day: "numeric",

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio