Version

Reducing Day on Invalid Date in WebDateTimeEditor

A common end-user scenario is when they enter a day of month value that actually exceeds the days in that month; WebDateTimeEditor™ allows you to handle this situation elegantly by automatically reducing the day of the month value upon invalid entry. The day of the month is reduced to the last day in that month. This feature is enabled by simply setting the WebDateTimeEditor control’s ReduceDayOnInvalidDate property. For example with this feature enabled, if the end-user enters 31 in the date field for the month of November, then the editor automatically sets the day field to 30 which is the maximum day in that month. However if the feature is not enabled, then the editor sets the day field to 1 and the month to December, essentially rolling the date forward into the next month.

You can set the ReduceDayOnInvalidDate property either by using the Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

WebDateTimeEditor1.ReduceDayOnInvalidDate = true

In C#:

WebDateTimeEditor1.ReduceDayOnInvalidDate = true;