Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Comments

Replaced moment with dayjs fixed issue #34#47

Open
rohit-raje-786 wants to merge 3 commits intobench-routes:masterfrom
rohit-raje-786:issue_34
Open

Replaced moment with dayjs fixed issue #34#47
rohit-raje-786 wants to merge 3 commits intobench-routes:masterfrom
rohit-raje-786:issue_34

Conversation

@rohit-raje-786
Copy link

Replaced moment with dayjs to fixed issue #34

@ruddi10
Copy link
Contributor

ruddi10 commented Jan 21, 2022

@rohit-raje-786 hey actually react-datetime has a dependency on moment so when you are replacing it with dayjs isn't it causing some issues?

@ruddi10
Copy link
Contributor

ruddi10 commented Jan 21, 2022

I guess currently you haven't removed moment from your dependency and that's why it's working fine but it won't work if we remove moment from our dependency

@rohit-raje-786
Copy link
Author

Hey @ruddi10 have a look at it now I have replaced rect-datetime with @material-ui/pickers.And I have removed moment.js and react-datetime
Screenshot 2022-01-22 at 12 43 49 AM

@ruddi10
Copy link
Contributor

ruddi10 commented Jan 22, 2022

@aquibbaig I think in the older version of the dashboard we were using material-ui/pickers and there were some reasons that the maintainers wanted to go with react-datetime so what's your take on using something other than this package ? If so do you have some good alternative in your mind?

@@ -0,0 +1,11 @@
# This configuration file was automatically generated by Gitpod.
Copy link
Contributor

@aquibbaig aquibbaig Feb 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be a part of this PR

Copy link
Contributor

@aquibbaig aquibbaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for this PR, I am posting some initial feedback on your work

Screenshot 2022-02-06 at 2 43 22 AM

  1. Start Time -> Picker should be in a center-aligned vertically
  2. For the consistent look and feel, use the same font family and same font colors in pickers.
  3. Remove the background on click of the picker (or come up w a better design)

Comment on lines +33 to +34
const [startTime, setStartTime] = useState(dayjs(selectedStartTimestamp));
const [endTime, setEndTime] = useState(dayjs(selectedEndTimestamp));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say keep the start and end times in the redux store (and persist them too) so that it is maintained across refreshes (mostly people do not like dates getting reset)

};
const valid = (current: moment.Moment) => {
return current.isBefore(moment());
const valid = (current: dayjs.Dayjs) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the utils/ folder

const handleEndChange = (date: dayjs.Dayjs | string) => {
if (typeof date !== "string") {
setEndTime(date);
setError(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error is either null or Error

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants