This is a migrated thread and some comments may be shown as answers.

depth year last day of month

2 Answers 643 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Francesco
Top achievements
Rank 1
Francesco asked on 14 Jan 2013, 01:48 PM
Hi,
i have create a datetimepicker, i put depth: year
i want that when i select the month in the value appear the last day of the selected month and not the first day..

i select Jan   value: 01/01/2013  so i want that when i select a month in the value there is  31/01/2013  <- so the last day.

somebody know how to do?

Thank you

2 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 16 Jan 2013, 01:08 PM
Hi Francesco,

I have already answered your support ticket on the same subject, however I am pasting my reply here so the other users who are interested in the same can read it:  

I am afraid what you are trying to achieve is not supported in Kendo UI Date/TimePickers and its implementation requires additional code. As a possible approach you can hook up to the change event of the widgets, calculate the last day of the month and set the new date.

Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Francesco
Top achievements
Rank 1
answered on 16 Jan 2013, 01:21 PM
Thank you very much.. 

if someone need a code the solution is:

$("#data-a-copertura").kendoDatePicker({
//....,
change: function () {
var date = this.value();
date.setDate(new Date(date.getFullYear(), date.getMonth()+1, 0).getDate());
this.value = date  //or put this.set("bindname", date); if you use a data-bind.
}
});
Tags
Date/Time Pickers
Asked by
Francesco
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Francesco
Top achievements
Rank 1
Share this question
or