# Feature OP-10330 - Change date selection logic in new date picker

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-10330

## Planning

| Attribute | Value |
| --- | --- |
| Date | 2022-05-25 |
| Priority | Medium |
| Target versions | 12.2.0 |
| Sprint | 12.2.0 |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer | Parimal Satyal |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

The date selection in the date picker shall become more intuitive.

**Acceptance criteria**

**Rules for date selection (for 12.2, needs discussion)**

*   When the date picker is opened, by default, start date is in focus (unless you click on finish date).
*   If no date has been input, the field that is focused takes the date that is clicked on.
*   If one date has been input (eg. start date), the focus changes to the other date (eg. finish date). Clicking on two dates in this order would then select the start and finish dates.
    *   Unless the second date is earlier than start date, in which case, the dates inverse.
*   If two dates (start _and_ finish dates) are already input, there are three cases:
    *   If you click a date that is before the start date, this modifies the start date (independent of focus).
    *   If you click a date in between the start and finish dates, the field that takes this date depends on the focus.
    *   If you a click a date that is after the finish date, this depends on the focus:
        *   If start date is focused, then the selected date becomes the new start date, and the finish date is cleared (and now in focus).
        *   If the finish date is focused, the new date is taken, start date is maintaned.
*   If you click on the same date twice, it becomes the start _and_ the finish date.

**Date fields**

*   When the date picker is opened, a field is always in focus by default.
    *   When opened by clicking the &quot;start date&quot; field, the start date will be in focus by default.
    *   When opened by clicking the &quot;finish date&quot; field, the finish date will be in focus by default.
*   The user is able to input dates either:
    *   by clicking on the dates on the mini-calendar (in the date picker modal)
    *   by inputting the dates manually in the text fields for start date and finish date in ISO format.
    *   Selecting a start date by clicking on a date or by inputting and pressing tab will move the focus to the finish date.
*   The visual format for displaying dates is in ISO format

**Calendar**

*   Two months are displayed (current and next month)
*   Clicking on backwards/forwards advances the calendar by a single month
*   Typing a ISO-standard date will select that date automatically in the calendar.
*   Hovering on any date _**after**_ that initially selected date:
    *   will give a &quot;preview&quot; of the end date (as in, all dates between the selected start date and this second date will be highlighted on hover).
*   Hovering on any date _before_ that initially selected date:
    *   will also give a &quot;preview&quot; of the period selected, but in considering that first date as the finish date.
