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

Date Validation on Two Digit Year

1 Answer 160 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Satyabrata
Top achievements
Rank 1
Satyabrata asked on 08 Jan 2015, 02:31 PM
Hi,
  I am facing one issue with the telerik RadDatePicker in my WPF application. I have formatted the display date with DataFormat(MM/dd/yy) so that it display two digit
year like 01/02/20.

Now when I entered 01/02/20 into the textbox(RadWatermarkTextBox) of RadDatePicker the dropdown showing 2nd Jan 2020. But when I entered 01/02/55, the dropdown is showing 2nd Jan 1955.
I am not sure why it is inconsistent when I select two differnet date. I have to validate the date entered so that user can select date with in specific range.

I can not even update the SelectedDate/DisplayDate of the DatePicker from C# code.
Could you please help me how to establish the logic to validate the date with 2 digit year.
Also let me knwo how to update the SelectedDate/DisplayDate of the radDatePicker.

Regards
Satya

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 09 Jan 2015, 08:15 AM
Hello Satyabrata,

What I can suggest you would be to check the How to implement custom parsing article from our help documentation. It will allow to implement the required and the parse the dates as needed. However I tested the provided inputs in sample application and control parsed 01/02/55 as 2055 (please check the screenshot).

As for the SelectedDate/DisplayDate there isn't anything spacial that needs to done in order to set them. You just need to assign new DateTime object as shown below:

this.Picker.SelectedDate = new DateTime(2015, 5, 5);

Can you please share more details regarding the issues you face when setting the SelectedDate/DisplayDate properties (some sample code would be helpful)?

Hope this helps. 

Regards,
Kalin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
DatePicker
Asked by
Satyabrata
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or