Skip to content

Conversation

@ToBinio
Copy link
Contributor

@ToBinio ToBinio commented Jul 7, 2025

This adds a rawModelValue to the RangeCalendar representing the currently selected dates, including undefined values.

resolves #1820

@epr3
Copy link
Collaborator

epr3 commented Jul 27, 2025

Hello @ToBinio,

Thank you very much for your contribution!

Could you try adding this property to both DateRangeField and DateRangePicker?

@ToBinio
Copy link
Contributor Author

ToBinio commented Jul 27, 2025

Hi @epr3

I don't think this is necessary for either, since their behavior of the model already matches the behavior of rawModelValue

@epr3
Copy link
Collaborator

epr3 commented Jul 27, 2025

Hi @ToBinio,

Oh, right, then, to achieve consistency, could you update the logic for the modelValue instead of adding the new property?

It would bring the date range components in line in terms of modelValue expectations.

Thank you!

@ToBinio
Copy link
Contributor Author

ToBinio commented Jul 27, 2025

Oh, right, then, to achieve consistency, could you update the logic for the modelValue instead of adding the new property?

One problem with this, I just realized, is that the calendar has the option to cancel the selection with ESC while only a start date is selected.
How should this be handled?

  • Have modelValue represent the WIP select of the user and keep an internal "lastValidModel" for reverting?
  • Have a setting for the Calendar to switch between a strict (current) mode and a soft mode where the model represents the current selection and no undo existing? - this would also keep the change non-breaking

or something else

note: thoughts on having the WIP selection auto undo if the calendar loses focus?

@epr3
Copy link
Collaborator

epr3 commented Jul 30, 2025

I'm thinking the first option with the lastValidModel would make the most sense, also being tied in the escape key functionality.

@ToBinio ToBinio changed the title feat(RangeCalendar): add rawModelValue feat(RangeCalendar): make raw-value default v-model for RangeCalendar Aug 2, 2025
@ToBinio
Copy link
Contributor Author

ToBinio commented Aug 2, 2025

I have now made the v-model have the rawModel behavior - I also added an emit for if there is a new valid dateRange to make migration easier

just to note: the behavior of dateRangePicker also slightly changed since now, also during selection the model changes

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/reka-ui@2032

commit: 7d2417b

Copy link
Collaborator

@epr3 epr3 left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

@epr3 epr3 merged commit 52c0078 into unovue:v2 Aug 15, 2025
5 checks passed
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.

[Feature]: access to the currently selected state of RangeCalendar

2 participants