0

I use jquery.validate.unobtrusive library to validate my forms in ASP.NET MVC project. I always have a problems with Date validation and decimal numbers validation.

I have problems because in defferent cases I should use different localization and every locale have its own Date and decimal format.

I know that I can add Globalize library to solve this problem once and for all. But in some projects I can't use this library.

How can I check what validation masks (or rules in general) set up for Date, decimal and maybe some other locale sensitive types at the moment in different browsers?

Community
  • 1
  • 1
teo van kot
  • 12,350
  • 10
  • 38
  • 70

1 Answers1

1

They are located in the jquery.validate.js file (towards the end). For example the following are the rules for date and number in version 1.9.0.

// date
return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
// number
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); //