Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
waterdataui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water Mission Area
Internet of Water
waterdataui
Commits
a791fb48
Commit
a791fb48
authored
5 years ago
by
Yan, Andrew N.
Browse files
Options
Downloads
Patches
Plain Diff
add validation for start date preceding the end date
parent
4d3f68f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assets/src/scripts/components/hydrograph/index.js
+8
-3
8 additions, 3 deletions
assets/src/scripts/components/hydrograph/index.js
assets/src/scripts/components/hydrograph/index.spec.js
+1
-0
1 addition, 0 deletions
assets/src/scripts/components/hydrograph/index.spec.js
with
9 additions
and
3 deletions
assets/src/scripts/components/hydrograph/index.js
+
8
−
3
View file @
a791fb48
...
...
@@ -6,6 +6,7 @@ import { extent } from 'd3-array';
import
{
line
as
d3Line
,
curveStepAfter
}
from
'
d3-shape
'
;
import
{
select
}
from
'
d3-selection
'
;
import
{
createStructuredSelector
}
from
'
reselect
'
;
import
{
DateTime
}
from
'
luxon
'
;
import
{
addSVGAccessibility
}
from
'
../../accessibility
'
;
import
config
from
'
../../config
'
;
import
{
dispatch
,
link
,
provide
}
from
'
../../lib/redux
'
;
...
...
@@ -403,9 +404,6 @@ const dateRangeControls = function(elem, siteno) {
.
attr
(
'
class
'
,
'
usa-alert__heading
'
)
.
text
(
'
Date requirements
'
);
dateAlertBody
.
append
(
'
p
'
)
.
text
(
'
Both start and end dates must be specified.
'
);
customDateContainer
.
append
(
'
label
'
)
.
attr
(
'
for
'
,
'
date-input
'
)
.
attr
(
'
class
'
,
'
usa-label
'
)
...
...
@@ -434,7 +432,14 @@ const dateRangeControls = function(elem, siteno) {
const
userSpecifiedStart
=
customStartDate
.
node
().
value
;
const
userSpecifiedEnd
=
customEndDate
.
node
().
value
;
if
(
userSpecifiedStart
.
length
===
0
||
userSpecifiedEnd
.
length
===
0
)
{
dateAlertBody
.
selectAll
(
'
p
'
).
remove
();
dateAlertBody
.
append
(
'
p
'
)
.
text
(
'
Both start and end dates must be specified.
'
);
customDateValidationContainer
.
attr
(
'
hidden
'
,
null
);
}
else
if
(
DateTime
.
fromISO
(
userSpecifiedEnd
)
<
DateTime
.
fromISO
(
userSpecifiedStart
))
{
dateAlertBody
.
selectAll
(
'
p
'
).
remove
();
dateAlertBody
.
append
(
'
p
'
)
.
text
(
'
The start date must precede the end date.
'
);
}
else
{
customDateValidationContainer
.
attr
(
'
hidden
'
,
true
);
return
Actions
.
getUserRequestedDataForDateRange
(
...
...
This diff is collapsed.
Click to expand it.
assets/src/scripts/components/hydrograph/index.spec.js
+
1
−
0
View file @
a791fb48
...
...
@@ -136,6 +136,7 @@ const TEST_STATE = {
timeSeriesState
:
{
currentVariableID
:
'
45807197
'
,
currentDateRange
:
'
P7D
'
,
requestedTimeRange
:
null
,
showSeries
:
{
current
:
true
,
compare
:
true
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment