Skip to content

DatePicker: emits stale previous value after selecting a new date when initialized with a prefilled value #2330

Description

@pfafffabian-ifx

Detailed description of how to reproduce the problem

When the date picker is rendered with an existing date already set, selecting a new date can trigger onIfxDate twice:

  1. first with the newly selected date
  2. immediately after with the previously prefilled date

At the same time, the component’s value still remains on the old prefilled date instead of reflecting the newly selected one.

This causes consumers to receive a stale follow-up event and also prevents them from reliably reading the updated value directly from the component, unless they add custom guards.

Example

document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
  <ifx-date-picker 
  id="date-picker" 
  value="2026-05-18">
</ifx-date-picker>
`

const datePicker = document.querySelector<HTMLElement & { value?: string }>('#date-picker')

datePicker?.addEventListener('ifxDate', (event) => {
  const customEvent = event as CustomEvent
  console.log('ifxDate event detail:', customEvent.detail)
  console.log('ifxDate element value:', datePicker.value)
})

Logs

ifxDate event detail: {day: 31, month: 5, year: 2026}
main.ts:17 ifxDate element value: 2026-05-18
main.ts:16 ifxDate event detail: {day: 18, month: 5, year: 2026}
main.ts:17 ifxDate element value: 2026-05-18

Upload a screenshot

Describe the development framework

Expected behavior

ifxDate should emit only the newly selected date and value property should contain the new value

Additional information

No response

Metadata

Metadata

Labels

approvedUser request approvedbugSomething isn't workingrequestUser request

Type

No type

Projects

Status
Pending Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions