code cleanup

This commit is contained in:
madarsbiss 2021-09-22 23:51:59 +03:00
parent 09cf258a23
commit a80f19aa60

View File

@ -35,14 +35,11 @@ export const degToCompass = (num) => {
return arr[val % 16];
};
// unixToLocalTime
// unixToLocalTime (23:31)
export const unixToLocalTime = (unixSeconds, timezone) => {
//convert time to 19:23 (last received data in 24h format)
let time = new Date((unixSeconds + timezone) * 1000)
.toISOString()
.match(/(\d{2}:\d{2})/)[0];
// console.log(time);
// time = time.startsWith("0") ? time.substring(1) : time;
return time.startsWith("0") ? time.substring(1) : time;
};