I had a strange validation error on an ASP.NET MVC 3 site with a text field that accepts the date and time selected through jqueryui. The site is configured to work only with the es-ES culture and works most of the time, but the check is not performed every time a specific month is used in this text box. The datetime.parse method works every month, except for the march:
DateTime.Parse("15-feb-2012",CultureInfo.GetCultureInfo("es"), DateTimeStyles.None)
{15/02/2012 0:00:00}
Date: {15/02/2012 0:00:00}
DateTime.Parse("15-ene-2012",CultureInfo.GetCultureInfo("es"), DateTimeStyles.None)
{15/01/2012 0:00:00}
Date: {15/01/2012 0:00:00}
DateTime.Parse("15-abr-2012",CultureInfo.GetCultureInfo("es"), DateTimeStyles.None)
{15/04/2012 0:00:00}
Date: {15/04/2012 0:00:00}
...
every month works, except March, Marzo in Spanish ...
DateTime.Parse("15-mar-2012",CultureInfo.GetCultureInfo("es"), DateTimeStyles.None)
DateTime.Parse("15-mar-2012",CultureInfo.GetCultureInfo("es"), DateTimeStyles.None)' threw an exception of type 'System.FormatException'
base {System.SystemException}: {"String was not recognized as a valid DateTime."}
Any idea?
source
share