Hi everyone! Can someone help me?
When consuming the data from the API , I have problems with a function that is in charge of obtaining the data from OpenWeatherMap API (https://openweathermap.org/) to give it date and time format.
The problem function is in the converters.js file and is:
export const unixToLocalTime = (unixSeconds, timezone) => {
let time = new Date((unixSeconds + timezone) * 1000)
.toISOString()
.match(/(\d{2}:\d{2})/)[0];
return time.startsWith("0") ? time.substring(1) : time;
};
Could someone give me some guidance on how to solve this issue? Thank you very much in advance!!!