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

Parser: tweak the century

2 Answers 46 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 06 Mar 2011, 11:29 AM
When entering a date in the RadDatePicker, where the century is not specified (e.g. 6/20/76), is there a way to instruct the parser to deliver 1976 instead of 2076, short of reimplementing it?
Even if SelectableDateEnd and DisplayDateEnd are set to DateTime.Now, the parser still selects the future date.

Alternatively, is there a way to call your builtin parser (which works like a charm except for this small issue) from a custom Parse... event handler in order to tweak its result a bit?

Thanks
Phil

2 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 07 Mar 2011, 10:03 AM
Hello Philip,

You have to add an event handler to the ParseDateTimeValue event. There you can specify the desired result. Check the  most simple way how you can achieve that.

private void radDateTimePicker_ParseDateTimeValue(object sender, ParseDateTimeEventArgs args)
        {
            if(args.Result.HasValue)
            {
                args.Result = args.Result.Value.AddYears(-1000);
            }
  
              
        }



All the best,
Kaloyan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Philip
Top achievements
Rank 1
answered on 17 Mar 2011, 09:04 AM
Hello Kaloyan,

somtimes, the answer is so close... ;)

Thank you
Tags
DatePicker
Asked by
Philip
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Philip
Top achievements
Rank 1
Share this question
or