Permit users to choose Celsius or Fahrenheit.

This commit is contained in:
Chris Nielsen
2023-05-12 19:06:32 +00:00
parent c71476d4e8
commit e3360349bb
3 changed files with 86 additions and 39 deletions

View File

@@ -165,6 +165,11 @@ export const getValueFromCss = (colorVar) => {
return cssProps.getPropertyValue(`--${colorVar}`).trim();
};
/* Given a temperature in Celsius, returns value in Fahrenheit */
export const celsiusToFahrenheit = (celsius) => {
return Math.round((celsius * 1.8) + 32);
};
/* Given a temperature in Fahrenheit, returns value in Celsius */
export const fahrenheitToCelsius = (fahrenheit) => {
return Math.round(((fahrenheit - 32) * 5) / 9);