Skip to content

Commit

Permalink
change formula to get current date
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen-Duc-Khai committed Nov 19, 2023
1 parent dc904fc commit fa53c0f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,19 @@ window.onload = (event) => {
todayLabel.innerHTML = msg.today;
});

console.log();

// FORECAST--------------
fetchPredictDatas(new Date().toISOString().split("T")[0]);
const today = new Date();
const todayInTimeZone = today.toLocaleDateString("en-US", {
timeZone: "Asia/Ho_Chi_Minh",
});

const [month, day, year] = todayInTimeZone.split("/");
const formattedDate = `${year}-${month.padStart(2, "0")}-${day.padStart(
2,
"0"
)}`;

fetchPredictDatas(formattedDate);

// ---------------FORECAST

Expand Down

0 comments on commit fa53c0f

Please sign in to comment.