File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 54
54
// Populate date based on URL params or, if absent, the current date
55
55
if (sensor && ! sensor .active ) {
56
56
// If the sensor is inactive, set the start and end dates to its historical range rather than current date
57
- startDate = urlParams .has (' start_day' ) ? new Date (urlParams .get (' start_day' )) : sensor .meta .minTime ;
58
- endDate = urlParams .has (' end_day' ) ? new Date (urlParams .get (' end_day' )) : sensor .meta .maxTime ;
57
+ if (
58
+ urlParams .has (' start_day' ) &&
59
+ new Date (urlParams .get (' start_day' )) >= sensor .meta .minTime &&
60
+ new Date (urlParams .get (' start_day' )) <= sensor .meta .maxTime
61
+ ) {
62
+ startDate = new Date (urlParams .get (' start_day' ));
63
+ } else {
64
+ startDate = sensor .meta .minTime ;
65
+ }
66
+ if (
67
+ urlParams .has (' end_day' ) &&
68
+ new Date (urlParams .get (' end_day' )) <= sensor .meta .minTime &&
69
+ new Date (urlParams .get (' end_day' )) <= sensor .meta .maxTime
70
+ ) {
71
+ endDate = new Date (urlParams .get (' end_day' ));
72
+ } else {
73
+ endDate = sensor .meta .maxTime ;
74
+ }
59
75
} else {
60
76
startDate = urlParams .has (' start_day' ) ? new Date (urlParams .get (' start_day' )) : param .sparkLineTimeFrame .min ;
61
77
endDate = urlParams .has (' end_day' ) ? new Date (urlParams .get (' end_day' )) : param .sparkLineTimeFrame .max ;
You can’t perform that action at this time.
0 commit comments