Skip to Content
avatar image
Former Member

inconsistent date placeholder M/d/yy in English with sap.m.DatePicker

Dear Experts,

In order to display date format automatically according to user locale, we used the following setting to create a sap.m.DatePicker:

"formatOptions": "{style: 'short', format: 'yyMMdd', UTC: true}".

We are expecting the date placeholder to be displayed automatically according to locale. In German: dd.MM.yy

In English: MM/dd/yy

The placeholder works perfectly in German, however not in English.In English the Date placeholder is shown as : "M/d/yy". Weirdly after loading the Date from Gateway, the placeholder is correctly shown as "MM/dd/yy".

The code snippet looks like:

<DatePicker        
  value="{          
    path: '/myDate',          
    type: 'sap.ui.model.odata.type.DateTime',          
    constraints: {displayFormat: 'Date'},           
    formatOptions: {format:'yyMMdd', UTC: true}        
  }"        
  displayFormat="short"    
/>

The sapui5 version is 1.44.22 and Date defined in OData is of type Edm.DateTime. Your help is greatly appreciated.

Thanks,

Yang

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 07, 2017 at 04:04 PM

    Hi Yang Wang,

    it is correct that the placeholder displayed as M/d/yy for displayFormat="short". The date will be displayed as
    English (US): 8/7/17
    German (DE): 07.08.17
    If you need to show other placeholder you could set it manually through the property placeholder. This is however a fixed string.

    <DatePicker
    placeholder = "MM/dd/yy" />

    If no placeholder is set to the DatePicker , the used displayFormat is displayed as a placeholder.

    You can read further here:

    https://sapui5.hana.ondemand.com/#/api/sap.m.DatePicker

    http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table


    Cheers

    Cuong

    Add comment
    10|10000 characters needed characters exceeded