Skip to Content
avatar image
Former Member

sap.m.DatePicker default Time in Searchhelp

Hello Together,

I'm using a DateTimePicker which have a binding to a odata model.

<DateTimePicker id="dateInput" width="100%" value="{path:'FromDate', type:'sap.ui.model.odata.type.DateTime'}" displayFormat="short" tooltip="{i18n>FromDate}" required="true" />

When the field is empty and the user click to the search help, the current system date and systemtime is selected in the searchhelp-popup.

The current date is fine, but the current time is not wanted. the user wish a default time 00:00.

In most cases the user want only select a date. Only for some scenarios he want to enter a time too.

And it's not user friendly, when the user must always reset the date to 00:00.

Is it possible to set the default-date for the searchhelp? I doesn't want to set a default date for the field itself. only if the searchhelp is started.

kind regards

Stefan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 27, 2017 at 08:14 AM

    Hi Stefan ,

    Why can't you initialise the datePicker in the onInit function

    1. var oModel =newJSONModel();
    2. var iDate = newDate();
    3. iDate.setHours(0);
    4. iDate.setMinutes(0);
    5. iDate.setSeconds(0);
    6. oModel.setData({
    7. dateValue:iDate
    8. });
    9. this.getView().setModel(oModel);

    thanks

    Viplove

    Add comment
    10|10000 characters needed characters exceeded