Skip to content

Add Shift shortcut for selecting and deselecting multiple dates in between start and end dates - #4

Merged
peterchrjoergensen merged 7 commits into
mainfrom
shift-shortcut-for-selecting-multiple-dates-in-between
Jul 8, 2026
Merged

Add Shift shortcut for selecting and deselecting multiple dates in between start and end dates#4
peterchrjoergensen merged 7 commits into
mainfrom
shift-shortcut-for-selecting-multiple-dates-in-between

Conversation

@peterchrjoergensen

Copy link
Copy Markdown
Member

This pull request adds support for shift-click range selection in multiple-date mode for the date picker, along with the necessary logic and event handling to ensure a smooth user experience. The main changes include tracking the Shift key globally, managing range selection state, and updating selection logic to support adding or removing contiguous date ranges.

Multiple date selection improvements:

  • Implemented shift-click range selection in multiple date mode: holding Shift and clicking an end date selects all dates between the anchor and the clicked date; starting from a selected date removes the range instead. [1] [2]
  • Added global Shift key tracking and event listeners to handle Shift state, including cleanup on component unmount and window blur. [1] [2] [3]
  • Updated selection logic to reset range selection state when all dates are cleared or removed. [1] [2]

Code enhancements:

  • Added utility methods for normalizing dates, building date ranges, merging/removing selections, and checking if a date is selected.
  • Updated imports to include formatIsoDate used in new selection logic.

Documentation:

  • Updated README.md to describe the new shift-click range selection feature in multiple mode.

Enable range selection in multi-date mode by handling `@date-click` events in `FormField.vue`. The field now tracks Shift key state, remembers an anchor date, builds an inclusive date range between anchor and clicked date, and merges it into the current selection with deduplication and stable ordering.

Also reset the anchor when selections are cleared/emptied, and document the new Shift-click behavior in the README. Rebuilt compiled assets and manifest.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Shift-click range selection for multiple-date mode in the Nova datepicker field by tracking Shift globally and expanding/removing contiguous date ranges between an anchor date and the clicked date.

Changes:

  • Wire @date-click to custom range-selection handler for multi-date mode (add/remove ranges).
  • Add Shift key global tracking + range selection helpers (normalize, range build, merge/remove, selected check).
  • Document Shift range selection behavior in README; update compiled asset manifest hash.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 4 comments.

File Description
resources/js/components/FormField.vue Add Shift-click range selection logic, global Shift tracking, and selection utilities for multi-date mode.
README.md Document Shift-click range selection behavior in multiple mode.
dist/mix-manifest.json Update asset hash for rebuilt JS bundle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread resources/js/components/FormField.vue
Comment thread resources/js/components/FormField.vue
Comment thread resources/js/components/FormField.vue
Comment thread README.md Outdated
peterchrjoergensen and others added 2 commits July 8, 2026 09:52
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@peterchrjoergensen
peterchrjoergensen marked this pull request as ready for review July 8, 2026 07:56
@peterchrjoergensen
peterchrjoergensen merged commit d5391b9 into main Jul 8, 2026
3 checks passed
@peterchrjoergensen
peterchrjoergensen deleted the shift-shortcut-for-selecting-multiple-dates-in-between branch July 8, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants