Skip to content

DatePicker: valueFormat not respected, displayFormat works #12580

@Robert-M-Muench

Description

@Robert-M-Muench

Describe the bug

V 2.15.1

<FormItem labelContent={<Label>Expected Close Date</Label>}>
<DatePicker
  valueFormat="yyyy-MM-dd"
  value={expectedCloseDate}
  onChange={(e) => {
    console.log(e)
    setExpectedCloseDate(e.detail.value)
}}/>
</FormItem>

gives the wrong format for detail.value ("31.10.2025" instead of "2024-10-31"):

CustomEvent {isTrusted: false, detail: {}, type: 'change' , target: ui5-date-picker, currentTarget: ui5-date-picker, ...} 1
isTrusted: false
bubbles: true
cancelBubble: false
cancelable: true
composed: false
currentTarget: null
defaultPrevented: false
 detail:
valid: true
value: "30.10.2025"
 [[Prototypell: Object
eventPhase: 0
returnValue: true
 srcElement: ui5-date-picker
 target: ui5-date-picker
timeStamp: 65289.10000002384
type: "change"
 [[Prototype]]: CustomEvent

Adding displayFormat="yyyy-MM-dd" works, and then value has the correct format.

UI5 Web Components for React Version

2.15.1

UI5 Web Components Version

2.15.1

Browser

Chrome

Operating System

macOS

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions