Skip to content

Use date range pickers in ressource management#24262

Merged
klaustopher merged 3 commits into
devfrom
feature-OP-19685
Jul 15, 2026
Merged

Use date range pickers in ressource management#24262
klaustopher merged 3 commits into
devfrom
feature-OP-19685

Conversation

@klaustopher

Copy link
Copy Markdown
Contributor

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

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

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
@klaustopher klaustopher changed the title Feature op 19685 Use date range pickers in ressource management Jul 15, 2026

@mrmir mrmir 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.

Looks good to me, with a couple of caveats:

  1. 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
  2. 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?

@klaustopher klaustopher merged commit aa19975 into dev Jul 15, 2026
20 checks passed
@klaustopher klaustopher deleted the feature-OP-19685 branch July 15, 2026 13:11
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

2 participants