cancel
Showing results for 
Search instead for 
Did you mean: 

sap.m.DatePicker max date Problem

Former Member
0 Kudos

Hi everyone,

Just wondering if anyone else has noticed the issue with the DatePicker and values greater than 12/31/2043?  It knocks the year date back to 19** for any value greater 2043.  Any way to adjust this?

Tom

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

you have to set the date format to "yyyy" in the SAP general settings.

i hope it's help you.

regards Alessandro

jmoors
Active Contributor
0 Kudos

I've just tried the SAPUI5 explored DatePicker example and it seems to let me add dates greater than 2043. Have you added any particular validation / conversion?

SAPUI5 Explored

Regards,

Jason

jmoors
Active Contributor
0 Kudos

Actually I can recreate it in the 3rd example with the short display format.

Looks like it might be a bug, you might be able to use a different formatting option as a workaround?

Regards,

Jason

Former Member
0 Kudos

Thanks Jason!

Sorry, I wasn't very informative on my specific case.  I have a simple check on whether the date is in the past using the "change" event.  My specific DatePicker is in an XML view, bound to an Odata model and is using a "long" displayFormat, as shown below.

For the time being, I just down adjust any dates on the backend system to 12/31/2043, although for some reason it shows as 12/30/2043 in the DatePicker.. 


<DatePicker id="validToDate"

      dateValue="{path:'Tdate', formatter:'fnDateTimeFormatter'}"

      displayFormat="long"

      change="handleDateChange"

      width="200px" />


function fnDateTimeFormatter(oValue){

       if (oValue == undefined || oValue == "") {

            return;

       }

       return new Date(oValue);

};


handleDateChange : function(oValue) {

       var oView = this.getView();

       var oDatePicker = oView.byId("validToDate");

       var oEntry = oDatePicker.getDateValue();

       this.validateNewDate(oEntry);

},

Tom

jmoors
Active Contributor
0 Kudos

I think you must be using two digit year somewhere, is your oData returning yy instead of yyyy? If you supply two digit years it has cutoff for determining if it should use 19xx or 20xx when converting.

Regards,

Jason

Former Member
0 Kudos

I'm not sure where that could be/is being set.  In my Odata service, I'm getting an Edm.DateTime value like this -> <d:Tdate>2043-12-31T00:00:00</d:Tdate>.

<Property Name="Tdate" Type="Edm.DateTime" Precision="7" sap:label="Valid through" sap:creatable="false" sap:sortable="false" sap:filterable="false"/>

And I can verify that the Odata value shows correctly for values greater than the year 2043 (before my backend edit was in place).