Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
a0a8be94
Commit
a0a8be94
authored
May 24, 2021
by
Arnaud B
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vérification de la date de naissance
parent
a00afa2c
Pipeline
#975
passed with stage
in 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
prepa_odoo.js
members/static/js/prepa_odoo.js
+25
-2
No files found.
members/static/js/prepa_odoo.js
View file @
a0a8be94
...
...
@@ -21,6 +21,16 @@ var to_fill_box = $('#to_fill'),
problem_delete
=
$
(
'#problem_delete'
),
vform
=
$
(
'#coop_validation_form'
);
// date validation
Date
.
prototype
.
isValid
=
function
()
{
// If the date object is invalid it
// will return 'NaN' on getTime()
// and NaN is never equal to itself.
return
this
.
getTime
()
===
this
.
getTime
();
};
sync
.
on
(
'change'
,
function
(
info
)
{
// handle change
if
(
info
.
direction
==
'pull'
)
{
...
...
@@ -248,17 +258,30 @@ function save_current_coop(callback) {
sex_error
=
false
;
if
(
/
([
0-9
]{2})\/([
0-9
]{2})\/([
0-9
]{4})
/
.
exec
(
birthdate
))
{
var
jj
=
RegExp
.
$1
,
try
{
var
jj
=
RegExp
.
$1
,
mm
=
RegExp
.
$2
,
aaaa
=
RegExp
.
$3
;
if
(
jj
>
31
||
mm
>
12
||
aaaa
<
1900
||
aaaa
>
2018
)
{
let
tmp_date
=
aaaa
+
"-"
+
mm
+
"-"
+
jj
;
// try to create a date object
date_test
=
new
Date
(
tmp_date
);
// if date is invalid a correction is apply in date object. Check it
// january start at 0, so we add + 1 for the month
if
((
date_test
.
getDate
()
!==
parseInt
(
jj
))
||
((
date_test
.
getMonth
()
+
1
)
!==
parseInt
(
mm
))
||
(
date_test
.
getFullYear
()
!==
parseInt
(
aaaa
))
||
!
date_test
.
isValid
())
{
birthdate_error
=
true
;
}
}
catch
(
Exception
){
birthdate_error
=
true
;
}
}
else
{
birthdate_error
=
true
;
}
let
street2_input
=
form
.
find
(
'[name="street2"]'
),
phone_input
=
form
.
find
(
'[name="phone"]'
);
...
...
Write
Preview
Markdown
is supported
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