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) => {
|
export const timeTo12HourFormat = (time) => {
|
||||||
//23:43 to 11:43
|
let [hours, minutes] = time.split(":");
|
||||||
const [hours, minutes] = time.split(":");
|
hours %= 12;
|
||||||
return `${hours % 12}:${minutes}`;
|
return `${hours ? hours : 12}:${minutes}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const degToCompass = (num) => {
|
export const degToCompass = (num) => {
|
||||||
//degree to compass direction
|
|
||||||
var val = Math.floor(num / 22.5 + 0.5);
|
var val = Math.floor(num / 22.5 + 0.5);
|
||||||
var arr = [
|
var arr = [
|
||||||
"N",
|
"N",
|
||||||
@ -34,7 +33,6 @@ export const degToCompass = (num) => {
|
|||||||
return arr[val % 16];
|
return arr[val % 16];
|
||||||
};
|
};
|
||||||
|
|
||||||
// unixToLocalTime (23:31)
|
|
||||||
export const unixToLocalTime = (unixSeconds, timezone) => {
|
export const unixToLocalTime = (unixSeconds, timezone) => {
|
||||||
let time = new Date((unixSeconds + timezone) * 1000)
|
let time = new Date((unixSeconds + timezone) * 1000)
|
||||||
.toISOString()
|
.toISOString()
|
||||||
|
@ -6,12 +6,9 @@ import {
|
|||||||
} from "./converters";
|
} from "./converters";
|
||||||
|
|
||||||
export const getWindSpeed = (systemUsed, windInMps) =>
|
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 = (
|
export const getVisibility = (systemUsed, visibilityInMeters) =>
|
||||||
systemUsed,
|
|
||||||
visibilityInMeters // visibility in kilometers or in miles
|
|
||||||
) =>
|
|
||||||
systemUsed == "metric"
|
systemUsed == "metric"
|
||||||
? (visibilityInMeters / 1000).toFixed(1)
|
? (visibilityInMeters / 1000).toFixed(1)
|
||||||
: kmToMiles(visibilityInMeters / 1000);
|
: kmToMiles(visibilityInMeters / 1000);
|
||||||
@ -29,7 +26,6 @@ export const getAMPM = (systemUsed, currentTime, timezone) =>
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
export const getWeekDay = (weatherData) => {
|
export const getWeekDay = (weatherData) => {
|
||||||
//get the name of the week day
|
|
||||||
const weekday = [
|
const weekday = [
|
||||||
"Sunday",
|
"Sunday",
|
||||||
"Monday",
|
"Monday",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user