Skip to content

Conversation

didip1000
Copy link
Contributor

@didip1000 didip1000 commented Sep 23, 2025

With this PR we introduce a new "From/To (Date & Time)" option for the ui5-dynamic-date-range, allowing users to select a range of dates with times.

Example:

image

Usage:

To add the option to your DynamicDateRange, add DATETIMERANGE in the options attribute as follows:

 <ui5-dynamic-date-range options="TODAY, TOMORROW, DATETIMERANGE"></ui5-dynamic-date-range>

Related to: #12182

@didip1000 didip1000 requested a review from hinzzx September 23, 2025 07:05
Copy link
Contributor

@hinzzx hinzzx left a comment

Choose a reason for hiding this comment

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

Selecting a range starting with the bigger date (e.g. From 22 Sep – To 2 Sep ) works fine the first time selecting it. However, if right after that we change the date, the displayed Selected: <date range> is wrong, until we Submit.

Please refer:
2025-09-24_09-40-52 (1)

@ui5-webcomponents-bot
Copy link
Collaborator

🚀 Preview deployment ready: https://UI5.github.io/webcomponents/pr-12341/

The preview will be updated automatically when you push new commits to this PR.

@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Sep 26, 2025

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview September 26, 2025 14:02 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview September 26, 2025 14:22 Inactive
@didip1000 didip1000 requested a review from hinzzx October 2, 2025 10:28
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 2, 2025 10:33 Inactive
};

const dateTimeRangeOptionToDates = (value: DynamicDateRangeValue): Array<Date> => {
const startDate = value.values ? value.values[0] as Date : UI5Date.getInstance();
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor:
It took me a while to understand what does this actually do.

We can adjust it a little for readibility, like e.g. (havent tested it, just suggestion)

    const [firstValue, secondValue] = value.values || [];
    const currenDate = UI5Date.getInstance();

    const startDate = firstValue instanceof Date ? firstValue : currentDate;
    const endDate = secondValue instanceof Date ? secondValue : currentDate;

    return [startDate, endDate];
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Imo both approaches read very similar to me, and considering all other toDates methods are formulated the same way, I'm leaving it as-is for now. If @tsanislavgatev has a strong preference for your suggestion, I can change it then.

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.

4 participants