diff --git a/src/converter.js b/src/converter.js index fa9d6b4..c064b6a 100644 --- a/src/converter.js +++ b/src/converter.js @@ -348,14 +348,16 @@ function weatherForecast(geo_position = liveLocation) { if (req.readyState === XMLHttpRequest.DONE) { isRenderMuhurata = true; if (req.status === 200) { - resData = JSON.parse(req.response); - // console.log(resData) + data = JSON.parse(req.response); + // console.log(data) // SunRise SunSet Value: // document.getElementById('latitude').value = geo_position.latitude; // document.getElementById('longitude').value = geo_position.longitude; - document.getElementById("day-start-end-time").innerHTML = `SunRise: ${resData.daily.sunrise}
SunSet: ${resData.daily.sunset} -

${getMuhurta(resData.daily.sunrise)} `; + document.getElementById("day-start-end-time").innerHTML = ` + Timezone: ${data.timezone} (Lati: ${data.latitude} Long: ${data.longitude})
+ SunRise: ${data.daily.sunrise}
SunSet: ${data.daily.sunset} +

${getMuhurta(data.daily.sunrise)} `; } else { console.log(`Request failed with status code ${req.status} from url ${req.responseURL}`); } @@ -380,7 +382,7 @@ function getMuhurta(time1) { .forEach((ele, index) => { ele.startTime= minToHhrMin((paseTimeInMinutesFromDate(dt) + muhurta*ele.index)%(24*60)); ele.endTime= minToHhrMin((paseTimeInMinutesFromDate(dt) + muhurta*(ele.index+1))%(24*60)); - res += `${index+1}: ${ele.name}: ${ele.startTime} - ${ele.endTime} (${muhurta}M)
`; + res += `${String(index+1).padStart(2, '0')}. ${ele.name}: ${ele.startTime} - ${ele.endTime} (${muhurta}M)
`; }) return res; }