-
Notifications
You must be signed in to change notification settings - Fork 26
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
Redo DateTimeInput with downshift #282
Conversation
df503d4
to
5d790e5
Compare
8f9f94d
to
6e5e083
Compare
@@ -0,0 +1,135 @@ | |||
// Difference of this file to utils.js is that this file |
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.
why the name calendar-time
?
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.
Those are utilities for a calendar which respects time. It was really hard to find good names here. We need the utils to:
- share logic between the calendars (
DateInput
&DateRangInput
).DateTimeInput
uses its own utils (this file). - keep the date library (
moment
) out of our components which makes them more readable and makes it easier to replace the date-library if we ever want to
return addFlatpickrOffset(value, timeZone); | ||
const preventDownshiftDefault = event => { | ||
// eslint-disable-next-line no-param-reassign | ||
event.nativeEvent.preventDownshiftDefault = true; |
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.
That's a really nice way to give a lot of opt-in control to consumers.
getDaysInMonth(today, this.props.timeZone) - | ||
1, | ||
}), | ||
() => this.inputRef.current.focus() |
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.
💯
The blue color represents "today". It is not the default highlighted date.A highlight looks like this. The 14th is highlighted here.
Thanks for the hint. This was a problem in Firefox only. I fixed it there now (in #281). |
3ac9eb3
to
2932680
Compare
6e5e083
to
0da4c39
Compare
0da4c39
to
89d0e0b
Compare
This is the new
DateTimeInput
based ondownshift
.See also #281 which replaces
DateInput
.Breaking Change Previously
onChange
would be called with the value directly. Now it gets called with an event containing the value. This was done to be in line with how the other inputs work.