Skip to Content
0

Date is not formatting correctly in Datepicker

Mar 13, 2017 at 09:46 AM

64

avatar image

Hi Experts,

I am using sap.m.DatePicker in my application and I am binding the value property for my datepicker as below.

new sap.m.DatePicker({value:{path : '/bindDate', type : 'sap.ui.model.type.Date', formatOptions:{pattern : 'dd/MM/yyyy', strictParsing : true}}})

It is working fine and the date which user is entering is checked for validation and checked properly. But it is failing in only one condition when the user enters the date as "02102016" or "020116". In this condition the date is converted to "10/02/2016" instead of "02/10/2016".

Could you please help to rectify these and to convert the date in required format.

Thanks,

Sanjay Aswani

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

2 Answers

Best Answer
Sanjay Aswani Mar 15, 2017 at 11:04 AM
0

Hi Saurabh,

Thanks for the answer. But I got the issue. I am currently using SAP UI5 version 1.38.5 and in this version it is a bug. But in latest version the date picker is working as expected.

Thanks & Regards

Sanjay Aswani

Share
10 |10000 characters needed characters left characters exceeded
saurabh vakil Mar 14, 2017 at 11:01 AM
1

With the below code I tried entering 02102016 and 021016 in the DatePicker field, on pressing Enter I get the date 02/10/2016.

<DatePicker value="{path: 'HireDate', type: 'sap.ui.model.type.Date', 
formatOptions: {
pattern: 'dd/MM/yyyy'
}}" />
Share
10 |10000 characters needed characters left characters exceeded