Skip to content

Commit

Permalink
Methods: Fix dateITA method, avoiding summertime errors
Browse files Browse the repository at this point in the history
Using arbitrary hour or new Date() will use hour 00:00:00, which cause errors
on summertime changes.

Closes gh-773
  • Loading branch information
jzaefferer committed Jan 14, 2014
1 parent 8c92533 commit 279b932
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/additional/dateITA.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jQuery.validator.addMethod("dateITA", function(value, element) {
var gg = parseInt(adata[0],10);
var mm = parseInt(adata[1],10);
var aaaa = parseInt(adata[2],10);
var xdata = new Date(aaaa,mm-1,gg);
var xdata = new Date(aaaa, mm-1, gg, 12, 0, 0, 0);
if ( ( xdata.getFullYear() === aaaa ) && ( xdata.getMonth() === mm - 1 ) && ( xdata.getDate() === gg ) ){
check = true;
} else {
Expand Down
1 change: 1 addition & 0 deletions test/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ test("mobileUK", function() {
test("dateITA", function() {
var method = methodTest("dateITA");
ok( method( "01/01/1900" ), "Valid date ITA" );
ok( method( "17/10/2010" ), "Valid date ITA" );
ok(!method( "01/13/1990" ), "Invalid date ITA" );
ok(!method( "01.01.1900" ), "Invalid date ITA" );
ok(!method( "01/01/199" ), "Invalid date ITA" );
Expand Down

0 comments on commit 279b932

Please sign in to comment.