Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
clientside_validation
Commits
5154953a
Commit
5154953a
authored
Jan 18, 2013
by
lkmorlan
Committed by
Peter Droogmans
Jan 18, 2013
Browse files
Issue #1886424 by Liam Morland: Fixed Date validation fails when text is used instead of numbers.
parent
0416e803
Changes
2
Hide whitespace changes
Inline
Side-by-side
clientside_validation.js
View file @
5154953a
...
...
@@ -1146,8 +1146,18 @@
var
parts
=
value
.
split
(
param
.
splitter
);
var
expectedpartscount
=
0
;
var
day
=
parseInt
(
parts
[
param
.
daypos
],
10
);
var
month
=
parseInt
(
parts
[
param
.
monthpos
],
10
);
if
(
isNaN
(
month
))
{
if
(
typeof
Drupal
.
settings
.
clientside_validation_settings
[
parts
[
param
.
monthpos
]]
!==
undefined
)
{
month
=
Drupal
.
settings
.
clientside_validation_settings
[
parts
[
param
.
monthpos
]];
}
else
{
month
=
new
Date
(
parts
[
param
.
monthpos
]
+
"
1, 2000
"
);
month
=
month
.
getMonth
();
}
month
=
month
-
1
;
var
year
=
parseInt
(
parts
[
param
.
yearpos
],
10
);
var
date
=
new
Date
();
var
result
=
true
;
...
...
@@ -1293,4 +1303,4 @@
}
};
})(
jQuery
);
\ No newline at end of file
})(
jQuery
);
clientside_validation.module
View file @
5154953a
...
...
@@ -38,6 +38,14 @@ function clientside_validation_js_alter() {
}
}
}
// Provide conversion table between translated month names, both full and abbreviated, and their number.
foreach
(
range
(
1
,
12
)
as
$month_number
)
{
$date
=
mktime
(
12
,
0
,
0
,
$month_number
,
1
,
1970
);
$clientside_validation_settings
[
'clientside_validation_settings'
][
'months'
][
t
(
date
(
'F'
,
$date
))]
=
$month_number
;
$clientside_validation_settings
[
'clientside_validation_settings'
][
'months'
][
t
(
date
(
'M'
,
$date
))]
=
$month_number
;
}
drupal_add_js
(
$clientside_validation_settings
,
'setting'
);
}
...
...
@@ -1555,7 +1563,7 @@ function clientside_validation_library_alter(&$libraries, $module) {
}
$path
=
drupal_get_path
(
'module'
,
'clientside_validation'
);
// Replace jQuery Form plugin.
$libraries
[
'jquery.form'
][
'js'
][
'misc/jquery.form.js'
][
'data'
]
=
$path
.
'/jquery.form.js'
;
$libraries
[
'jquery.form'
][
'version'
]
=
'3.09'
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment