-
Notifications
You must be signed in to change notification settings - Fork 827
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
Range selection disallowed when includes excluded dates #4812
Range selection disallowed when includes excluded dates #4812
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/uber-ui-platform/baseweb/AdHJMasjSegkUUSBsUxiY3pui5pY |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit eded636:
|
Visual changes were detected on this branch. Please review the following PR containing updated snapshots: #4813 |
@@ -104,6 +104,16 @@ export default class Datepicker<T = Date> extends React.Component< | |||
} else { | |||
nextDate = [start, start]; | |||
} | |||
} else if ( | |||
this.dateHelpers.dateRangeIncludesDates( | |||
// $FlowFixMe Cannot call `this.dateHelpers.dateRangeIncludesDates` with `nextDate` bound to the first parameter because read-only array type [1] is incompatible with array type [2] |
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.
Flow thinks DateValueT
is a read-only array, but the actual type is DateValueT<T> = ?T | Array<?T>
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.
I did a bunch of testing to see why this is erroring but no luck :(
@@ -104,6 +104,16 @@ export default class Datepicker<T = Date> extends React.Component< | |||
} else { | |||
nextDate = [start, start]; | |||
} | |||
} else if ( | |||
this.dateHelpers.dateRangeIncludesDates( | |||
// $FlowFixMe Cannot call `this.dateHelpers.dateRangeIncludesDates` with `nextDate` bound to the first parameter because read-only array type [1] is incompatible with array type [2] |
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.
I did a bunch of testing to see why this is erroring but no luck :(
* fix(datepicker): disallow range when includes excluded dates * chore(datepicker): e2e tests for excluded dates in range * test(vrt): update visual snapshots for 886f5f0 (#4813) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(datepicker): slight change to dateRangeIncludesDates * chore(datepicker): remove console.warn Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com>
* initialize v11 feature branch * chore(datepicker): accommodate null date values (#4694) * chore(datepicker): accommodate null date values * chore(datepicker): accommodate null date values * chore(datepicker): change DateValueT to array type * chore(datepicker): revert unnecessary changes to tests * chore(datepicker): fix onChange erroneously called twiced * chore(datepicker): stylistic cleanup * remove `$FlowFixMe`s * avoid using `null` in DateValue array when `undefined` suffices * rename `value[0]` and `value[1]` to `start` and `end` * fix(datepicker): handle pseudo-highlighting when startDate is null * fix(datepicker): add null date placeholder Datepicker uses `react-input-mask` as the default input component. Previously, cases where StartDate is null but EndDate caused incorrect formatting of the date range displayed in the input. To resolve this issue, a placeholder must be provided which conforms to the mask that is passed `react-input-mask`. * chore(datepicker): add integration tests for null start date situations * test(vrt): update visual snapshots for 6bdf37d [skip ci] (#4748) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(datepicker): forcing a new build Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * feat(timepicker): remove timePickerAriaLabel (#4779) * chore(typography): remove deprecated typography components (#4768) * feat(spinner): deprecate current default and replace with next version (#4793) * feat(spinner): promote StyledSpinnerNext to Spinner * fix(spinner): correct file name * test(vrt): update visual snapshots for 01500a7 [skip ci] (#4785) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * feat(modal): remove Backdrop element and remove unstable_ModalBackdropScroll (#4794) * feat(modal): remove backdrop element and ModalBackdropScroll prop * fix(modal): update unit tests * Add locked calendar behavior 2 (#4808) * feat(datepicker): implement locking behavior * chore(datepicker): minor cleanup * use INPUT_DELIMITER where possible * change `date` to `nextDate` * test(vrt): update visual snapshots for c4c4bd8 [skip ci] (#4809) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(datepicker): enhance integration tests per code review * chore(datepicker): use INPUT_DELIMITER as replacement for en dash Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * feat(modal): removes no-capitalization autofocus prop (#4800) * Range selection disallowed when includes excluded dates (#4812) * fix(datepicker): disallow range when includes excluded dates * chore(datepicker): e2e tests for excluded dates in range * test(vrt): update visual snapshots for 886f5f0 (#4813) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(datepicker): slight change to dateRangeIncludesDates * chore(datepicker): remove console.warn Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * feat(accordion): remove renderPanelContent prop (#4821) * chore(radio): remove radio group overrides pass through (#4828) Radio overrides should be applied directly to instances of Radio, rather than to RadioGroup. * feat(phone-input): promote next component to default (#4827) * feat(phone-input): promote next component to default * test(vrt): update visual snapshots for e35a1a7 (#4829) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(button): remove minimal type (#4834) * chore(button): remove minimal button * fix(theme): remove styles update docs * test(vrt): update visual snapshots for 3023093 (#4835) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(select): remove SearchIcon props from SearchIconContainer (#4831) context: #2397 * chore(lint): merge lint fixes (#4845) * feat(eslint): add no-component-classname lint rule (#4830) * feat(eslint): add noClassname lint rule * docs(eslint): add new rule to readme * feat(button): accept arbitrary color in button component (#4836) * feat(button): accept arbitrary color in button component * feat(button): update custom color prop naming * feat(button): document and fix scenario * test(vrt): update visual snapshots for 593f6bd (#4837) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * Fix typo in TS definitions (#4840) * chore(eslint): align eslint deps (#4839) * chore(eslint): align eslint deps * chore(eslint): exclude problem test from flow check * chore: bump vite and ladle (#4841) * chore(flow): update flow, resolve errors (#4842) * chore(flow): update flow, resolve errors * chore(flow): fix tests, update type Co-authored-by: Chase Starr <chasestarr@gmail.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: Todor Grigorov <contact@todorgrigorov.com> Co-authored-by: Vojtech Miksu <vojtech@uber.com> * Merge master to v11 (#4849) * feat(eslint): add no-component-classname lint rule (#4830) * feat(eslint): add noClassname lint rule * docs(eslint): add new rule to readme * feat(button): accept arbitrary color in button component (#4836) * feat(button): accept arbitrary color in button component * feat(button): update custom color prop naming * feat(button): document and fix scenario * test(vrt): update visual snapshots for 593f6bd (#4837) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * Fix typo in TS definitions (#4840) * chore(eslint): align eslint deps (#4839) * chore(eslint): align eslint deps * chore(eslint): exclude problem test from flow check * chore: bump vite and ladle (#4841) * chore(flow): update flow, resolve errors (#4842) * chore(flow): update flow, resolve errors * chore(flow): fix tests, update type * chore: bump to ladle public version (#4848) * chore(flow): move from eslint weak type to flowlint (#4846) * chore(flow): move from eslint weak type to flowlint * chore(lint): add generated files * chore(flow): add more flow lint rules * chore(flow): add new rules * chore(flow): align flow rules * chore(flow): fix sketchy and change Co-authored-by: Chase Starr <chasestarr@gmail.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: Todor Grigorov <contact@todorgrigorov.com> Co-authored-by: Vojtech Miksu <vojtech@uber.com> * Merge master into v11 (#4854) * chore: merge master to v11 * chore(deps): add missing package.json deps * chore(v11): manual changes after merge * docs(v11): add v11 blog post (#4872) * docs(v11): add v11 blog post * Update documentation-site/pages/blog/base-web-v11/index.mdx * chore(v11): remove isError from radio/radiogroup (#4883) * chore(v11): remove deprecated theme values (#4877) * chore(theme): remove deprecated theme colors * chore(v11): remove unused component color tokens * fix(tsc): remove deprecated colors from TS files * chore(ci): clean up color references * chore(v11): fix toggle error color * test(vrt): update visual snapshots for 358f164 (#4878) Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> * feat(checkbox): make toggle_round default and remove square toggle (#4873) * feat(checkbox): make toggle_round default toggle * fix(checkbox): update ts * test(vrt): update visual snapshots for 7a73948 (#4874) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * chore(checkbox): remove isError prop * chore(checkbox): remove from ts definition Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * fix(datepicker): fix date-dependant test (#4897) * fix(datepicker): fix date-dependant test * fix(datepicker): correct package version * fix(datepicker): update node * fix(datepicker): update node in volta config * test(vrt): update visual snapshots for c01b3a4 (#4898) Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> * fix(datepicker): revert dependency changes * fix(datepicker): revert yarn lock changes Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: Luke Brennan <luke.brennan@uber.com> Co-authored-by: UberOpenSourceBot <33560951+UberOpenSourceBot@users.noreply.github.com> Co-authored-by: UberOpenSourceBot <UberOpenSourceBot@users.noreply.github.com> Co-authored-by: Will Ernest <williame@uber.com> Co-authored-by: Todor Grigorov <contact@todorgrigorov.com> Co-authored-by: Vojtech Miksu <vojtech@uber.com>
Description
Previously, ranged Datepicker allowed a ranged selection to span across dates that have been explicitly excluded by the user via the
excludeDates
prop. This change disallows such range selections.Scope
Patch: Bug Fix