-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
✨ Permit users to choose Celsius or Fahrenheit. #1182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not :
Suggested change
To keep style consistent with the below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no reason to prefer one form or the other. Would you like me to make the suggested change, or are you asking merely out of curiosity? If the latter, it is because I asked Google for the formula for the conversion, even though the reverse formula was staring me in the face and I might have worked it out myself. If the former, I have no objections. Let me know if I should take action based on your suggestion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was suggesting it for the style consistency. It's your PR, and your code is fine... My suggestion may be viewed as nitpicking ;-) |
||||||
}; | ||||||
|
||||||
/* Given a temperature in Fahrenheit, returns value in Celsius */ | ||||||
export const fahrenheitToCelsius = (fahrenheit) => { | ||||||
return Math.round(((fahrenheit - 32) * 5) / 9); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a
this.error('msg')
(defined in the WidgetMixin.js) - which will display this to the user, as well as log to console - here's an example.But I'm happy either way :)