@@ -1560,6 +1560,8 @@ <h2>Validators</h2>
1560
1560
< dl class ="dl-horizontal ">
1561
1561
< dt > onlyInteger</ dt >
1562
1562
< dd > Real numbers won't be allowed. The error message is < i > must be an integer</ i > </ dd >
1563
+ < dt > strict</ dt >
1564
+ < dd > Enables more strict validation of strings. Leading zeroes won't be allowed and the number cannot be malformed.</ dd >
1563
1565
< dt > greaterThan</ dt >
1564
1566
< dd > The input has to be greater than this value. The error message is < i > must be greater than %{count}</ i > </ dd >
1565
1567
< dt > greaterThanOrEqualTo</ dt >
@@ -1601,6 +1603,12 @@ <h2>Validators</h2>
1601
1603
validate({duration: "3"}, {duration: {numericality: true}});
1602
1604
// => undefined
1603
1605
1606
+ validate({duration: "03"}, {duration: {numericality: true}});
1607
+ // => undefined
1608
+
1609
+ validate({duration: "03"}, {duration: {numericality: {strict: true}}});
1610
+ // => {"duration": ["Duration must be a valid number"]}
1611
+
1604
1612
validate({duration: "3"}, {duration: {numericality: {noStrings: true}}});
1605
1613
// => {"duration": ["Duration is not a number"]}
1606
1614
@@ -2274,6 +2282,11 @@ <h3>
2274
2282
utility method. Thanks < a href ="https://github.com/ansman/validate.js/pull/111 " target ="_blank "> jpbufe3</ a >
2275
2283
for suggesting an implementing this.
2276
2284
</ li >
2285
+ < li >
2286
+ Added a strict option to the< a href ="#validators-numericality "> < code > numericality</ code > </ a >
2287
+ validator. Thanks < a href ="https://github.com/ansman/validate.js/pull/106 " target ="_blank "> mondwan</ a >
2288
+ for suggesting and implementing this.
2289
+ </ li >
2277
2290
</ ul >
2278
2291
</ div >
2279
2292
< div id ="changelog-0-9-0 ">
0 commit comments