|
|
@@ -33,10 +33,10 @@ const renderForecast = (f)=>{
|
|
|
day: "numeric",
|
|
|
year: "2-digit"
|
|
|
});
|
|
|
- tbody.children[0].children[i+1].textContent = `${f.apparent_temperature_min[i]} - ${f.apparent_temperature_max[i]}`;
|
|
|
- tbody.children[1].children[i+1].textContent = `${f.relative_humidity_2m_mean[i]}%`;
|
|
|
+ tbody.children[0].children[i+1].textContent = `${f.temperature_2m_min[i]} - ${f.temperature_2m_max[i]}`;
|
|
|
+ tbody.children[1].children[i+1].textContent = f.dew_point_2m_mean[i];
|
|
|
tbody.children[2].children[i+1].textContent = `${f.precipitation_probability_max[i]}%`;
|
|
|
- tbody.children[3].children[i+1].textContent = (f.precipitation_sum[i] / 25.4).toFixed(2);
|
|
|
+ tbody.children[3].children[i+1].textContent = f.precipitation_sum[i].toFixed(2);
|
|
|
tbody.children[4].children[i+1].textContent = f.wind_speed_10m_max[i];
|
|
|
tbody.children[5].children[i+1].textContent = sunrise.toLocaleTimeString("en-US", timeOptions);
|
|
|
tbody.children[6].children[i+1].textContent = sunset.toLocaleTimeString("en-US", timeOptions);
|
|
|
@@ -44,7 +44,7 @@ const renderForecast = (f)=>{
|
|
|
}
|
|
|
|
|
|
const getWeather = ()=>{
|
|
|
- fetch("https://api.open-meteo.com/v1/forecast?latitude=33.54&longitude=-79.05&daily=temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,rain_sum,precipitation_sum,precipitation_probability_max,wind_speed_10m_max,wind_gusts_10m_max,wind_direction_10m_dominant,relative_humidity_2m_mean,weather_code¤t=temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m,wind_direction_10m,is_day&timezone=America%2FNew_York&forecast_days=3&temperature_unit=fahrenheit", {method: "GET"})
|
|
|
+ fetch("https://api.open-meteo.com/v1/forecast?latitude=33.54&longitude=-79.05&daily=temperature_2m_max,temperature_2m_min,sunrise,sunset,rain_sum,precipitation_probability_max,wind_speed_10m_max,wind_gusts_10m_max,precipitation_sum,wind_direction_10m_dominant,weather_code,dew_point_2m_mean¤t=temperature_2m,apparent_temperature,weather_code,wind_speed_10m,wind_direction_10m,is_day,dew_point_2m&timezone=America%2FNew_York&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch", {method: "GET"})
|
|
|
.then(r=>r.json())
|
|
|
.then((response)=>{
|
|
|
const tempDisplay = `${response.current.temperature_2m}\u00B0F`;
|
|
|
@@ -65,8 +65,8 @@ const getWeather = ()=>{
|
|
|
|
|
|
document.querySelector("#wind svg").style.transform = `rotate(${response.current.wind_direction_10m}deg)`;
|
|
|
|
|
|
- const humidity = `${response.current.relative_humidity_2m}% humidity`;
|
|
|
- document.getElementById("humidity").textContent = humidity;
|
|
|
+ const dewPoint = `Dew Point: ${response.current.dew_point_2m}\u00B0F`;
|
|
|
+ document.getElementById("dewPoint").textContent = dewPoint;
|
|
|
|
|
|
renderForecast(response.daily);
|
|
|
})
|