I’m having an issue where users will enter 07/16/30 into the field and the value gets saved as 07/16/1930 instead of 07/16/2030. If 07/16/29 is entered it gets saved as 07/16/2029.
I currently have my Mask Input set to "mm/dd/yyyy" and my Format String set to "MM/dd/yy"
Is there some default value that gets set for what year to choose when only the last 2 characters of the year have been entered?
Hi Jesse,
I don't see any way to do that. Is 1930 an invalid year for your users? You could set a MinDate on the control or handle the Validating event and prevent the users from entering older dates.
Thanks for the reply.
I actually did change it to a mask with a 4 digit year but still run into the same issue. the control still allows someone to enter "07/21/30" even though i have a "mm/dd/yyyy" mask on it; which then puts 1930 in instead of 2030. Is there a way to have the control force the full year? i would think a mask would force them to put in all 4 year digits but it does not.
Thanks,
Jesse
Hello,
Please let us know if you need any further assistance with this matter.
Hi,
This is not really related to the DateTimeEditor, this is the behavior of Microsoft Windows. If you only use 2 digits for the year, Microsoft arbitrarily designates the number 30 as the cutoff point for the century.
You can demonstrate this without using any Infragistics controls very simply like so:
string s = "07/16/30"; DateTime dt = DateTime.Parse(s); Debug.WriteLine(dt);
I recommend that you use a 4-digit mask for the year so that there is no ambiguity.