Skip to Content

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

Nov 06, 2017 at 02:54 PM


avatar image

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:

    path: '/myDate',          
    type: 'sap.ui.model.odata.type.DateTime',          
    constraints: {displayFormat: 'Date'},           
    formatOptions: {format:'yyMMdd', UTC: true}        

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



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Cuong Cao 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.

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:



10 |10000 characters needed characters left characters exceeded