浏览代码

Update the date issues.

Lee Morgan 6 月之前
父节点
当前提交
8dd341e0f4
共有 2 个文件被更改,包括 2 次插入1 次删除
  1. 0 0
      index.html
  2. 2 1
      index.js

文件差异内容过多而无法显示
+ 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",

部分文件因为文件数量过多而无法显示