Hi Progress Telerik,
When I type the date 01 09 18, the tooltip suggests 18 Sep 2001.
But when I type 01 09 2018, the tooltip suggests 01 Sep 2018.
I want the suggestion date to be 01 Sep 2018 when I type 01 09 18.
I'm using the CultureInfo en-US and date format dd MMM yyyy.
Kindly assist on how to achieve the same.
Thank You,
With Best Regards,
Muhammad Azhar Shah
5 Answers, 1 is accepted
To achieve the desired result, you also need to set the DateSeparator property of the culture's DateTimeFormat to a space:
picker.Culture.DateTimeFormat.DateSeparator =
" "
;
Please let me know if this works for you.
Regards,
Dilyan Traykov
Progress Telerik
Hi Dilyan,
Thank you very much. That is working as expected.
Regards,
Muhammad Azhar Shah
Hi Progress Telerik,
Thank You once again for the solution given.
There is another requirement to be fulfilled here. Whenever I type the first set of numbers then it should be interpreted as Day only, not month. After applying DateTimeFormat.DateSeparator = " ", I'm facing an issue.
If I type 11 => suggesting as 11 Sep 2018 which is what I want.
But when I type 11 2 => suggesting as 02 Nov 2018 which I don't want. I want the suggestion date to be 11 Feb 2018 here. Meaning that the first set of numbers should be interpreted as Day.
Similarly, when I type 13 02 => displays error, But I want it to be 13 Feb 2018.
Please find the attached image.
This requirement should not disturb my previous requirement. When I type 01 09 18, it should display 01 Sep 2018.
Hope you understand my requirements. Kindly give me a solution to fix the same.
Thank You,
With Best Regards,
Muhammad Azhar Shah
For the parsings you specified to work, you need to set the MonthDayPattern of the culture's DateTimeFormat:
picker.Culture.DateTimeFormat.MonthDayPattern =
"dd MM"
;
Doing so provides the desired result at my end. Please let me know if that is the case for you as well.
Regards,
Dilyan Traykov
Progress Telerik
Hi Dilyan,
Thumbs up. Thank You.
Regards,
Muhammad Azhar Shah