Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
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
0
Merge Requests
0
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
WEBGDE-Components
web-ui
Commits
b1bec4d7
Commit
b1bec4d7
authored
Jan 22, 2024
by
Alfonso Abella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WG-484 validdate input
parent
2396ede2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
validateInput.js
...ebContent/WebGde-Widgets/DataInputWidget/validateInput.js
+17
-5
No files found.
WebGde/WebContent/WebGde-Widgets/DataInputWidget/validateInput.js
View file @
b1bec4d7
...
...
@@ -234,8 +234,7 @@ const validateDate = (validation, value) => {
try
{
if
(
mandatory
&&
(
value
.
length
===
0
||
!
value
.
match
(
/
\S
/g
)))
return
{
valid
:
false
,
errors
:
[
'Field is required.'
]
}
if
(
validdate
===
"past"
){
if
(
validdate
!=
""
){
if
(
value
.
length
===
0
)
{
return
{
valid
:
true
};
}
...
...
@@ -252,13 +251,26 @@ const validateDate = (validation, value) => {
const
currentDate
=
new
Date
();
console
.
log
(
currentDate
);
switch
(
validdate
){
case
"past"
:
if
(
enteredDate
<
currentDate
)
{
return
{
valid
:
true
};
// The date is in the past
}
else
{
return
{
valid
:
false
,
errors
:
[
'Future date not allowed.'
]
};
return
{
valid
:
false
,
errors
:
[
'Only past dates are allowed.'
]
};
}
case
"current"
:
if
(
enteredDate
=
currentDate
)
{
return
{
valid
:
true
};
// The date is today
}
else
{
return
{
valid
:
false
,
errors
:
[
'Only current date is allowed.'
]
};
}
case
"future"
:
if
(
enteredDate
>
currentDate
)
{
return
{
valid
:
true
};
// The date is in the future
}
else
{
return
{
valid
:
false
,
errors
:
[
'Only future dates are allowed.'
]
};
}
}
}
return
{
valid
:
true
}
...
...
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