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

RadDatePicker auto-correcting day values

3 Answers 50 Views
Input
This is a migrated thread and some comments may be shown as answers.
johnv
Top achievements
Rank 2
johnv asked on 14 Sep 2010, 08:56 PM
The RadDatePicker seems to be correcting day values if you put in a date that doesn't exist.

Ex: 2/29/2010 auto-corrects to 2/28/2010.

Can I turn this off like the RadNumericTextBox?

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Sep 2010, 12:39 PM
Hello,

Add the following client side code in order to override the built-in date parser engine.

JavaScript:
<script type="text/javascript">     
    Telerik.Web.UI.RadDateInput.prototype.parseDate = function(value, baseDate)     
    {     
        if (new Date(value) != "NaN")     
            return value;     
    }     
</script>  


Hope this helps,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
johnv
Top achievements
Rank 2
answered on 15 Sep 2010, 02:07 PM
Thank you for the script; unfortunately, it didn't work as I had hoped. I want the control to continue formatting the date, but I don't want it to change the day. When I placed this into my control, it simply fails validation all the time. I should also mention that I added a startup script that causes validation during the onblur client event.

Example:
2/28/2010 should pass validation and be formatted to 28 Feb 2010 but 2/29/2010 should fail validation and be formatted to 29 Feb 2010

Thanks!
0
Maria Ilieva
Telerik team
answered on 16 Sep 2010, 10:01 AM
Hello,

I am afraid that the autocorrect functionality has been implemented on purpose and it cannot be prevented, unless you disable the whole parsing mechanism of the embedded DateInput control, which is the same as using a regular textbox.

http://www.telerik.com/community/forums/aspnet-ajax/calendar/raddatepicker-autocorrect.aspx


Best wishes,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Input
Asked by
johnv
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
johnv
Top achievements
Rank 2
Share this question
or