add getweekday fx

This commit is contained in:
madarsbiss
2021-09-22 19:15:02 +03:00
parent 92d22cd650
commit 2af4c0c5e2
2 changed files with 19 additions and 19 deletions

View File

@@ -1,5 +1,22 @@
import { convertTime, kmToM, mpsToMph, timeToAMPM } from "./converters";
export const getWeekDay = (weatherData) => {
const weekday = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
return weekday[
new Date(
convertTime(weatherData.dt, weatherData.timezone).input
).getUTCDay()
];
};
export const isPM = (time) => {
let hours = time.split(":")[0];
if (hours >= 12) {