services cleanup
This commit is contained in:
parent
eee3aa60f9
commit
8ce1d66cce
@ -1,17 +1,16 @@
|
||||
export const ctoF = (c) => (c * 9) / 5 + 32; //celsius to fahrenheit
|
||||
export const ctoF = (c) => (c * 9) / 5 + 32;
|
||||
|
||||
export const mpsToMph = (mps) => (mps * 2.236936).toFixed(2); //meters per second - miles per hour
|
||||
export const mpsToMph = (mps) => (mps * 2.236936).toFixed(2);
|
||||
|
||||
export const kmToMiles = (km) => (km / 1.609).toFixed(1); //kilometers to miles
|
||||
export const kmToMiles = (km) => (km / 1.609).toFixed(1);
|
||||
|
||||
export const timeTo12HourFormat = (time) => {
|
||||
//23:43 to 11:43
|
||||
const [hours, minutes] = time.split(":");
|
||||
return `${hours % 12}:${minutes}`;
|
||||
let [hours, minutes] = time.split(":");
|
||||
hours %= 12;
|
||||
return `${hours ? hours : 12}:${minutes}`;
|
||||
};
|
||||
|
||||
export const degToCompass = (num) => {
|
||||
//degree to compass direction
|
||||
var val = Math.floor(num / 22.5 + 0.5);
|
||||
var arr = [
|
||||
"N",
|
||||
@ -34,7 +33,6 @@ export const degToCompass = (num) => {
|
||||
return arr[val % 16];
|
||||
};
|
||||
|
||||
// unixToLocalTime (23:31)
|
||||
export const unixToLocalTime = (unixSeconds, timezone) => {
|
||||
let time = new Date((unixSeconds + timezone) * 1000)
|
||||
.toISOString()
|
||||
|
@ -6,12 +6,9 @@ import {
|
||||
} from "./converters";
|
||||
|
||||
export const getWindSpeed = (systemUsed, windInMps) =>
|
||||
systemUsed == "metric" ? windInMps : mpsToMph(windInMps); //meters per second to miles per hour
|
||||
systemUsed == "metric" ? windInMps : mpsToMph(windInMps);
|
||||
|
||||
export const getVisibility = (
|
||||
systemUsed,
|
||||
visibilityInMeters // visibility in kilometers or in miles
|
||||
) =>
|
||||
export const getVisibility = (systemUsed, visibilityInMeters) =>
|
||||
systemUsed == "metric"
|
||||
? (visibilityInMeters / 1000).toFixed(1)
|
||||
: kmToMiles(visibilityInMeters / 1000);
|
||||
@ -29,7 +26,6 @@ export const getAMPM = (systemUsed, currentTime, timezone) =>
|
||||
: "";
|
||||
|
||||
export const getWeekDay = (weatherData) => {
|
||||
//get the name of the week day
|
||||
const weekday = [
|
||||
"Sunday",
|
||||
"Monday",
|
||||
|
Loading…
x
Reference in New Issue
Block a user