Skip to content

fix(ui5-date-range-picker): remove relative date handling#13365

Open
hinzzx wants to merge 2 commits intomainfrom
drp-rel-dates-removal
Open

fix(ui5-date-range-picker): remove relative date handling#13365
hinzzx wants to merge 2 commits intomainfrom
drp-rel-dates-removal

Conversation

@hinzzx
Copy link
Copy Markdown
Contributor

@hinzzx hinzzx commented Apr 3, 2026

Overview

Currently our ui5-daterange-picker resolves relative dates like "today" and "tomorrow" to concrete dates. The sap.m.DateRangeSelection does not. It sets an error state instead, meaning that both project handles same scenarios in different ways causing inconsistencies.

So in order to fix this we:

  • Added roundtrip check to detect relative date strings in DateRangePicker
  • Modified isValid(), isValidValue(), isValidDisplayValue() to reject them

What This Fixes

  • Relative dates ("today", "tomorrow", etc.) now set valueState="Negative" instead of resolving
  • Behavior aligns with sap.m.DateRangeSelection
  • DatePicker continues resolving relative dates as before

@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

ui5-webcomponents-bot commented Apr 3, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview April 3, 2026 14:34 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview April 6, 2026 06:49 Inactive
@GDamyanov GDamyanov self-requested a review April 6, 2026 12:42

describe("DateRangePicker relative dates rejection", () => {
it("typing 'today' sets error state", () => {
cy.mount(<DateRangePicker></DateRangePicker>);
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.

Most of the tests are executing same logic I suggest something like that:
const relativeKeywords = ["today", "tomorrow", "yesterday"];

relativeKeywords.forEach(keyword => {
    it(`typing '${keyword}' sets error state`, () => {
        cy.mount(<DateRangePicker></DateRangePicker>);

        cy.get("[ui5-daterange-picker]")
            .as("dateRangePicker")
            .shadow()
            .find("[ui5-datetime-input]")
            .realClick()
            .should("be.focused");

        cy.realType(keyword);
        cy.realPress("Enter");

        cy.get("@dateRangePicker")
            .should("have.value", keyword)
            .should("have.attr", "value-state", "Negative");
    });
});`

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.

3 participants