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

DatePicker Range Selection changes format

2 Answers 261 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Alex Smitt
Top achievements
Rank 1
Alex Smitt asked on 06 Dec 2011, 03:39 AM
if you go to demos DatePicker Range Selection then pick today from the bottom of the first one and then do the same with the second picker, you'll notice change of format. You can do the same starting with the second.
How to get rid of this and have date in correct format?

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 07 Dec 2011, 02:47 PM
Hello Alex,

 
Thank you for pointing this issue. It is caused by setting a date, which is not in the range. In the "Range selection" demo, when end-user clicks the today's link, the calendar tries to set a date, which is not in the range. The issue will be fixed for the next internal build of KendoUI, which is available only for customers.
You can patch the kendo.datepicker.js file in order to fix this issue:

[Old _update method]:

_update: function(value) {
            var that = this,
                options = that.options,
                format = options.format,
                date = parse(value, format);
 
            if (!isInRange(date, options.min, options.max)) {
                date = null;
            }
 
            that._value = date;
            that.dateView.value(date);
            that.element.val(date ? kendo.toString(date, format) : value);
 
            return date;
        },

[New _update method]:
_update: function(value) {
            var that = this,
                options = that.options,
                format = options.format,
                date = parse(value, format);
 
            if (!isInRange(date, options.min, options.max)) {
                date = null;
            }
 
            that._value = date;
            that.dateView.value(date);
            that.element.val(kendo.toString(date ? date : value, format));
 
            return date;
        },

The other option is to turn off the footer of the calendar.

As a gratitude for your involvement I have updated your Telerik points.
Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Alex Smitt
Top achievements
Rank 1
answered on 07 Dec 2011, 10:07 PM
Thank you for your answer
Tags
DatePicker
Asked by
Alex Smitt
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Alex Smitt
Top achievements
Rank 1
Share this question
or