Content
View differences
Updated by Parimal Satyal over 1 year ago
## Context
This will be worked on **Work in parallel with ##59845. progress, specs are being writen**
## Acceptance criteria
**Work package date picker**
Modify the current work package: package date picker:
* There are now two different date selection modes available:
* single-date, where Resize the work package has only a three fields (start date, finish date or a start date
* range, where and duration) so they are all the work package has both dates and a duration
same width.
* By default, new New work packages will start open in single-date mode range mode, with only the Finish date available all three fields being available.
* If a work package has both start and finish dates, it will open in range mode as it does today.
* In range mode, Clicking on the date field opens the date picker behaves exactly with all three fields (start date, finish date, duration) visible, enabled and editable.
* It will behave as it does today, as described in ##59845 today (no change).
* The 'x' icon will continue to clear the value of the active field whilst keeping focus on it.
* If a work package has only one date, whether it be start of finish, it will open in single date mode:
* The other date field is and the duration fields are replaced with a button with by buttons (of the same height and width as the input would fields) with a centered + trailing icon and the appropriate label ("Start date" or "Finish date") (add) icon.
* The Duration field will be available but empty.
* Clicking on the add date + (add) button will switch converts the button into a field, and make it active. The date picker now goes into range mode: it will replace the button with the appropriate input field and switch focus to it
mode.
* Entering If a duration will automatically switch from single to range mode, since the start date can now be derived
* _\[open\] On blur? Whenever is added, the input duration buttons is taken also automatically turned into account._
* In single date mode, in the Flatpickr mini-calendar below, the selected date will be curved in all sides (vs. a field. _\[**Open**: immediately or on only one end when in range mode)
blur after a value is input?\]_
* An clear trailing action (X icon) If a duration is always visible when either the Start or Finish added, the _other_ date fields field is available
* _Note: Ideally, we would only show the clear button also automatically turned into a field. _\[**Open**: immediately or on focus and only when there blur after a value is a value; however, Primer might not allow this behaviour out of the box_
input?\]_
* The clear action clears the value but does not change the mode until save; the A range date picker remains will remain in single date or range mode.
mode until it is closed by clicking on the _Save_ button:
* When If only a single date picker is saved entered in range mode, it will open in single-date mode if one or both dates were cleared.
* If one date is cleared and the date picker is saved, it will go into single date mode with the _other_ date field active (the one with the value). on next opening.
* If both two dates are cleared and the date picker is saved, it will go into single-date mode with the Finish date active.
* _\[open\] If a work package is entered in single date range mode, but the user clicks on the other field (in a work package table, for example), it will not make that field active; instead, the date picker will display with the existing date remain in focus. The user has to consciously add that second date to be able to input a range._
* _This can be challenged; we can also assume that if the user actively clicks range mode on an empty date field, it means they want to entert a value._ next opening.
**Work package list**
* In a work package table, When clicking specifically on Start date, Finish date the value of a start or Duration will display finish column, the date picker opens with that field in focus active:
* _\[open\] However, if a work package is in single date mode, but the user clicks on the other If that field (in a work package table, for example), does not exist, it will not make that field active; instead, the date picker will display open with the existing date in focus. The user has to consciously add that second date to be able to input a range._
* _This can be challenged; we can also assume that if equivalent of the user actively clicks "Add" button clicked, ie. focus on an empty date field, it means they want to entert a value._
**Mobile**
* No additional mobile-centric behaviour in addition to what is specified in ##61051
field.
## Visuals
**Finish date-only work package date picker:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55831/content">
**Click on the add button under the sart date to add it:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:520px;" src="/api/v3/attachments/298043/content"> style="width:596px;" src="/api/v3/attachments/55832/content">
**When both dates are present, the date picker goes into its usual range mode:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55833/content">
**In range mode, clicking on a second date will complete the range (as it does today):**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55836/content">
**Clearing a field with the X icon will clear the field but stay in range mode:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55839/content">
**A start date-only date picker is possible too:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:520px;" src="/api/v3/attachments/298061/content"> style="width:596px;" src="/api/v3/attachments/55834/content">
### Mockup
Figma link: [https://www.figma.com/design/HrWVktq0SsGI2dqqIKQ11M/Scheduling---Lag-and-Modes?node-id=1547-8988](https://www.figma.com/design/HrWVktq0SsGI2dqqIKQ11M/Scheduling---Lag-and-Modes?node-id=1547-8988) [https://www.figma.com/file/amVGcHqRQyR8x4EsqV9H99/Date-picker?node-id=261-26140](https://www.figma.com/file/amVGcHqRQyR8x4EsqV9H99/Date-picker?node-id=261-26140)
### Out of scope
* Changing default behaviour in the admin settings
* ~~Single Single date selection in range mode (something like:~~ [~~https://flatpickr.js.org/plugins/#rangeplugin-beta)~~](https://flatpickr.js.org/plugins/#rangeplugin-beta)~~/). like: [https://flatpickr.js.org/plugins/#rangeplugin-beta)](https://flatpickr.js.org/plugins/#rangeplugin-beta)/). This is when, even in range mode, a click on the calendar sheet will affect only the actively selected date:~~ date:
* ~~Selecting Selecting a range by simple clicking two dates will not be possible.~~ possible.
* ~~Range Range preview on highlight will not be possible.~~ possible.
* ~~Flipping Flipping start/finish to allow users to click-select ranges regardless of the order of the clicks (start first and then finish or vice-versa) will not be possible.~~ possible.
* ~~This This is out of scope because the above plugin only supports this behaviour for basic date pickers attached to outside date inputs and not inside a modal like in our date picker. It might still be possible (effort unknown, but in all likely hood substanstial) in a hacky way but the result is likely to be unsatisfactory and error-prone compared to the above-proposed button solution.~~ _~~(@Oliver Günther: solution. _(<mention class="mention" data-id="9177" data-type="user" data-text="@Oliver Günther">@Oliver Günther</mention>: could you confirm this is accurate?)~~_ accurate?)_
* Changing default behaviour in the admin settings
This will be worked on
## Acceptance criteria
**Work package date picker**
Modify the current work package:
* There are now two different date selection modes available:
* single-date, where
* range, where
* If a work package has both start and finish dates, it will open in range mode as it does today.
* In range mode,
* It will behave
* The 'x' icon will continue to clear the value of the active field whilst keeping focus on it.
* If a work package has only one date, whether it be start of finish, it will open in single date mode:
* The other date field is
* The Duration field will be available but empty.
* Clicking on the add date
* _\[open\] On blur? Whenever
* In single date mode, in the Flatpickr mini-calendar below, the selected date will be curved in all sides (vs.
* _Note: Ideally, we would only show the clear button
* If one date is cleared and the date picker is saved, it will go into single date mode with the _other_ date field active (the one with the value).
* If both
* _\[open\] If a work package is
* _This can be challenged; we can also assume that if the user actively clicks
**Work package list**
* In a work package table,
* _\[open\] However, if a work package is in single date mode, but the user clicks on the other
* _This can be challenged; we can also assume that if
**Mobile**
* No additional mobile-centric behaviour in addition to what is specified in ##61051
**Finish date-only work package date picker:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55831/content">
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55833/content">
**In range mode, clicking on a second date will complete the range (as it does today):**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55836/content">
**Clearing a field with the X icon will clear the field but stay in range mode:**
<img class="image_resized op-uc-image op-uc-image_inline" style="width:596px;" src="/api/v3/attachments/55839/content">
<img class="image_resized op-uc-image op-uc-image_inline" style="width:520px;" src="/api/v3/attachments/298061/content">
### Mockup
Figma link: [https://www.figma.com/design/HrWVktq0SsGI2dqqIKQ11M/Scheduling---Lag-and-Modes?node-id=1547-8988](https://www.figma.com/design/HrWVktq0SsGI2dqqIKQ11M/Scheduling---Lag-and-Modes?node-id=1547-8988)
### Out of scope
* Changing default behaviour in the admin settings
* ~~Single
* ~~Selecting
* ~~Range
* ~~Flipping
* ~~This
* Changing default behaviour in the admin settings