Use date range pickers in ressource management#24262
Merged
Merged
Conversation
The start and end dates of a resource planner and of a resource allocation are picked as one range in the UI, so both models expose that range as a single `date_range` attribute: the joined string the range date picker posts and reads back. Only start_date and end_date are ever persisted or validated; date_range translates between the two, which lets the picker be bound through the regular attribute assignment done by the SetAttributes services, leaving the contracts untouched. A resource planner's timeframe stays optional, but it is now either empty or complete: a half-open range cannot be picked as a range, so it is rejected. The demo seeder derived each end of the planner's range independently from the seeded work packages, which would have produced such a half-open range had those work packages been dated on one side only; it now yields no range at all in that case. Refs OP-19685
Both the allocate-resource dialog and the new/edit resource planner dialog offered two independent single date pickers, so picking a start date left the end date on its default instead of following along. They now use the range date picker, bound to the models' date_range attribute, and the controllers permit that single field in place of the two dates. The range picker had no way to clear a picked range. That is fine where both dates are required, as in the allocation dialog, but a resource planner's timeframe is optional and so has to be removable again. It gained an opt-in clear button, rendered inside the input and enabled only from the planner form, so the work package filters and the pause reminders keep their current appearance. Flatpickr keeps its own selection, so it is reset alongside the value; otherwise it would restore the cleared range the next time the calendar was opened. On mobile the native date inputs clear themselves and no button is drawn. The two eslint disables are for pre-existing offences in the touched file: the empty callbacks are the ControlValueAccessor's no-ops until it registers the real ones, and onDayCreate does await. Both are flagged only now because the hook lints the whole file once it is staged. Refs OP-19685
The resource planner header described its timeframe through three branches, one per combination of the two dates. A timeframe is now either absent or complete, so the half-open cases and their translations are gone and a guard clause is left. The specs follow the dialogs onto the single date_range field and cover what the change makes possible: that a picked range is split back into the two dates, that clearing it unsets both, and that a half-open range is rejected. The header had no coverage of its timeframe at all and now has some. Refs OP-19685
mrmir
approved these changes
Jul 15, 2026
mrmir
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me, with a couple of caveats:
- If I start with a later date, then select an earlier date (ie, trying to select a negative range), it auto-corrects on closing the field to have them in the order that makes sense. I don't know if this is default behaviour, and probably makes sense to keep, but it is a little odd
- I don't see ways to render the errors to do with a missing date. If I select a start date and then click out, it reopens the datepicker for me without any errors being displayed. Should errors be visible here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/projects/OP/work_packages/OP-19685/activity
What are you trying to accomplish?
This includes a change to the range date picker adding a button to clear the input. We already have this on the single picker, but here it also makes sense for the ranges.
Screenshots
What approach did you choose and why?
Merge checklist