-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feature/update world clock widget #47
Conversation
michalskrzypek
commented
Sep 13, 2019
- added new date formats,
- separated date formats from time formats,
- added differentation between 24- and 12-hour clock
- changed datetime display in widget,
- added option to enable/disable display of date and time,
- moved constants and helpers related to WC widget to the adequate file.
@@ -40,3 +12,7 @@ export const sortByKey = (obj, key, asc = true) => Object.entries(obj) | |||
|
|||
return newObj; | |||
}, {}); | |||
|
|||
Array.prototype.insert = function ( index, item ) { |
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.
Adding methods to build in objects prototypes is considered a bad idea. These are reserved for internal language features. Please create an util function.
const date = getDateTime(timeZoneId, dateFormat); | ||
|
||
const initTime = getDateTime(timeZoneId, timeFormat); | ||
let [time, setTime] = useState(initTime); |
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.
Use const here, you won't reassign these values i suppose.
@@ -1,24 +1,41 @@ | |||
import React, {useState} from 'react'; | |||
import Typography from "@material-ui/core/Typography/index"; | |||
import {string} from "prop-types"; | |||
import {Typography} from "@material-ui/core"; |
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.
Move to components imports. I remind that you have 3 types of imports in the following order: libs, internal helpers/actions/hooks, components: 3rd party/own.
Feature/update world clock widget