Skip to content

feat(ui5-daterange-picker): two months mode is implemented#13196

Open
GDamyanov wants to merge 65 commits intomainfrom
twocalendars
Open

feat(ui5-daterange-picker): two months mode is implemented#13196
GDamyanov wants to merge 65 commits intomainfrom
twocalendars

Conversation

@GDamyanov
Copy link
Contributor

@GDamyanov GDamyanov commented Mar 5, 2026

This PR adds a new showTwoCalendars property to the DateRangePicker component that displays two consecutive months side by side, making it easier to select date ranges that span multiple months.

New Property - showTwoMonths (boolean, default: false)

  • When enabled, the calendar popup displays two consecutive months instead of one
  • Automatically adapts to mobile devices, showing a single calendar on phones
  • Works seamlessly with existing date range selectiond)

@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Mar 5, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 5, 2026 11:56 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 5, 2026 13:23 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 5, 2026 14:56 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 6, 2026 09:24 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 6, 2026 09:36 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 6, 2026 13:43 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 9, 2026 08:25 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 9, 2026 09:15 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 10:50 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 11:10 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 11:50 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 11:59 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 14:33 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 14:50 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 15:17 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 18, 2026 15:44 Inactive
@GDamyanov GDamyanov requested a review from hinzzx March 19, 2026 08:47
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 19, 2026 08:52 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview March 20, 2026 07:57 Inactive
}

_clearValue() {
this._tempValue = "";
Copy link
Contributor

Choose a reason for hiding this comment

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

We should only clear the _tempValue, because if the user has an existing date range (e.g., "Jan 1 - Jan 15"), opens the picker on mobile, selects new dates but then clicks Cancel, the original value is destroyed. Cancel should discard the new selection and restore the previous value, not clear everything.

So just this._tempValue = "";

_showTwoMonths = false;

@property({ type: Boolean })
stretch = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

the property is still in the Calendar.ts file, and it is not used anywhere

--_ui5_daypicker_item_now_selected_two_calendar_focus_secondary_text_padding_block: 0 0.5rem;
--_ui5_daypicker_two_calendar_item_selected_focus_margin_bottom: 0;
--_ui5_daypicker_two_calendar_item_selected_focus_padding_right: 0.4375rem;
--_ui5_calendar_multiple_months_height: calc(var(--_ui5_calendar_height));
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't need calc here, var(--_ui5_calendar_height) is enough

cy.get<Calendar>("#cal")
.then($cal => {
const selectedDates = $cal[0].selectedDates;
expect(selectedDates).to.have.length.greaterThan(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

After selecting a range, the exact length should be 2. Using greaterThan(1) would pass even with 3+ dates. Please fix in DateRangePicker.cy.tsx test file as well as there are some occurrencies also.

.ui5DateRangePickerGetCalendarHeaders()
.eq(0)
.find("[data-ui5-cal-header-btn-month]")
.focus();
Copy link
Contributor

Choose a reason for hiding this comment

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

While .focus() works in some cases, the project convention is to use .realClick() for interaction testing.

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