+
diff --git a/src/redux/reducers/filters.js b/src/redux/reducers/filters.js
index 55fe14746..c58949442 100644
--- a/src/redux/reducers/filters.js
+++ b/src/redux/reducers/filters.js
@@ -51,8 +51,8 @@ export const updateRequestStatus = status => ({
const initialState = {
// dateRange: null,
// Always store dates using the INTERNAL_DATE_SPEC.
- startDate: moment(DATE_RANGES[0].startDate, USER_DATE_SPEC).format(INTERNAL_DATE_SPEC),
- endDate: moment(DATE_RANGES[0].endDate, USER_DATE_SPEC).format(INTERNAL_DATE_SPEC),
+ startDate: null,
+ endDate: null,
councilId: null,
selected: [],
unselected: [],
From e85e8d5523da3c722285e5598d1a7228b6e0d2e0 Mon Sep 17 00:00:00 2001
From: githelsui
Date: Tue, 14 Oct 2025 21:35:28 -0700
Subject: [PATCH 11/13] Update DatePicker to account for initial null values
and further date selection via ReactDayPicker
---
.../common/ReactDayPicker/ReactDayPicker.jsx | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/components/common/ReactDayPicker/ReactDayPicker.jsx b/src/components/common/ReactDayPicker/ReactDayPicker.jsx
index b1569fcd8..63fe6548e 100644
--- a/src/components/common/ReactDayPicker/ReactDayPicker.jsx
+++ b/src/components/common/ReactDayPicker/ReactDayPicker.jsx
@@ -157,6 +157,7 @@ function ReactDayPicker({
// enteredTo represents the day that the user is currently hovering over.
const [enteredTo, setEnteredTo] = useState(endDate);
+ // Sets start date
const setFromDay = day => {
updateStartDate(moment(day).format(INTERNAL_DATE_SPEC));
};
@@ -166,13 +167,15 @@ function ReactDayPicker({
};
const handleDayClick = day => {
- if (!range) {
- setFromDay(day);
- return;
- }
-
- // If both startDate and endDate were already selected. Start a new range selection.
- if (startDate && endDate){
+ //Blank Map Implementation
+ console.warn('Date selected: ', day);
+
+ // Initial state: null startDate and endDate, user first selects start date
+ if(!startDate){
+ console.warn('Start Date Selected: ', day);
+ setFromDay(day);
+ } // If both startDate and endDate were already selected. Start a new range selection.
+ else if (startDate && endDate){
setFromDay(day);
updateEndDate(null);
setEnteredTo(null);
@@ -191,7 +194,7 @@ function ReactDayPicker({
}
} else {
// This should never happen. Log a warning.
- console.warn('Try to set a new date selection. Dates were in an invalid state. StartDate: ', startDate, " endDate: ", endDate);
+ console.warn('ReactDayPicker: Try to set a new date selection. Dates were in an invalid state. StartDate: ', startDate, " endDate: ", endDate);
}
};
From 9e36469077f106ff2d95f81646b1169dc12f7f67 Mon Sep 17 00:00:00 2001
From: githelsui
Date: Wed, 15 Oct 2025 18:17:05 -0700
Subject: [PATCH 12/13] Update ReactDayPicker to account for missing start date
validation
---
src/components/common/DatePicker/DatePicker.jsx | 13 +++++++------
.../common/ReactDayPicker/ReactDayPicker.jsx | 15 +++++++++++++--
src/components/layout/Main/Desktop/FilterMenu.jsx | 8 ++++++--
3 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/components/common/DatePicker/DatePicker.jsx b/src/components/common/DatePicker/DatePicker.jsx
index 51c0a6f39..19416dc2e 100644
--- a/src/components/common/DatePicker/DatePicker.jsx
+++ b/src/components/common/DatePicker/DatePicker.jsx
@@ -99,12 +99,13 @@ function DatePicker({
() => {
if (startDate && endDate){
setShowCalendar(false);
- } else if (startDate && !endDate){
- // The calendar was closed with an incomplete date range selection so we need to restart
- // startDate and endDate to their initial values
- updateStartDate(initialStartDate);
- updateEndDate(initialEndDate);
- setShowCalendar(false);
+ // For Blank Map Implementation: no need to reset date range selection for testing purposes for date form validation
+ // } else if (startDate && !endDate){
+ // // The calendar was closed with an incomplete date range selection so we need to restart
+ // // startDate and endDate to their initial values
+ // updateStartDate(initialStartDate);
+ // updateEndDate(initialEndDate);
+ // setShowCalendar(false);
} else {
// This should never happen. Log a warning.
console.warn('Try to set a new date selection. Dates were in an invalid state. StartDate: ', startDate, " endDate: ", endDate);
diff --git a/src/components/common/ReactDayPicker/ReactDayPicker.jsx b/src/components/common/ReactDayPicker/ReactDayPicker.jsx
index 63fe6548e..fbf856680 100644
--- a/src/components/common/ReactDayPicker/ReactDayPicker.jsx
+++ b/src/components/common/ReactDayPicker/ReactDayPicker.jsx
@@ -168,12 +168,23 @@ function ReactDayPicker({
const handleDayClick = day => {
//Blank Map Implementation
- console.warn('Date selected: ', day);
-
+ console.warn('Current start date: ', startDate);
+ console.warn('Current end date: ', endDate);
+ var selectedDate = moment(day).format(INTERNAL_DATE_SPEC)
+ console.warn('Date selected: ', selectedDate);
+
// Initial state: null startDate and endDate, user first selects start date
if(!startDate){
console.warn('Start Date Selected: ', day);
setFromDay(day);
+ // Case: missing start date, user unselects start date
+ } else if(startDate && startDate == selectedDate) {
+ console.warn('Same start date selected, remove start date: ', selectedDate);
+ updateStartDate(null);
+ // Case: missing end date, user unselects end date
+ } else if(endDate && endDate == selectedDate) {
+ console.warn('Same end date selected, remove end date: ', selectedDate);
+ updateEndDate(null);
} // If both startDate and endDate were already selected. Start a new range selection.
else if (startDate && endDate){
setFromDay(day);
diff --git a/src/components/layout/Main/Desktop/FilterMenu.jsx b/src/components/layout/Main/Desktop/FilterMenu.jsx
index 660d8e8df..8fd870089 100644
--- a/src/components/layout/Main/Desktop/FilterMenu.jsx
+++ b/src/components/layout/Main/Desktop/FilterMenu.jsx
@@ -118,8 +118,12 @@ function FilterMenu({ resetMap, resetAddressSearch, map, geoFilterType, councils
}
// Date Range Validation
- if (!startDate || !endDate) {
- newErrors.dates = 'Please select both a start and end date';
+ if (!startDate && !endDate) {
+ newErrors.dates = 'Please select a date range';
+ } else if (!startDate && endDate) {
+ newErrors.dates = 'Please select a start date';
+ } else if (startDate && !endDate) {
+ newErrors.dates = 'Please select an end date';
}
console.log('startDate: ' + startDate);
console.log('endDate: ' + endDate);
From ad21c8f375fb291c10ad3cbeb4a54303d22638f3 Mon Sep 17 00:00:00 2001
From: githelsui
Date: Tue, 18 Nov 2025 16:00:30 -0800
Subject: [PATCH 13/13] Add event listener for cleared search bar to update
form validation
---
src/components/layout/Main/Desktop/FilterMenu.jsx | 10 +++++++---
src/features/Map/controls/MapSearch.jsx | 11 +++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/components/layout/Main/Desktop/FilterMenu.jsx b/src/components/layout/Main/Desktop/FilterMenu.jsx
index 8fd870089..9395d8bdd 100644
--- a/src/components/layout/Main/Desktop/FilterMenu.jsx
+++ b/src/components/layout/Main/Desktop/FilterMenu.jsx
@@ -103,8 +103,12 @@ function FilterMenu({ resetMap, resetAddressSearch, map, geoFilterType, councils
const dispatch = useDispatch();
const handleGeocoderResult = ( result ) => {
- console.log("Filter menu received address selected:", result.place_name);
- setSelectedAddress(result.place_name);
+ console.log("Filter menu - received address selected from MapSearch:", result.place_name);
+ if(result.place_name == '') {
+ setSelectedAddress(null);
+ } else {
+ setSelectedAddress(result.place_name);
+ }
};
const validateForm = () => {
@@ -153,7 +157,7 @@ function FilterMenu({ resetMap, resetAddressSearch, map, geoFilterType, councils
} else {
console.log("Invalid form", formErrors);
}
- setSelectedAddress(null);
+ // setSelectedAddress(null);
};
diff --git a/src/features/Map/controls/MapSearch.jsx b/src/features/Map/controls/MapSearch.jsx
index dcbd04e79..b3b4bccf7 100644
--- a/src/features/Map/controls/MapSearch.jsx
+++ b/src/features/Map/controls/MapSearch.jsx
@@ -133,7 +133,7 @@ class MapSearch extends React.Component {
// Blank Map Implementation: pass result to FilterMenu
const selectedAddress = result.place_name;
- console.log("Selected address:", selectedAddress);
+ console.log("MapSearch - Selected address:", selectedAddress);
this.props.onGeocoderResult(result);
// This clears the address from the Address input field.
@@ -145,6 +145,13 @@ class MapSearch extends React.Component {
// Add a custom event listener to clear the Address Search Input field
this.addListener(geocoderElement, settings.map.eventName.reset, ()=>this.geocoder.clear() )
+
+ //Listens to event when search address bar is cleared
+ this.geocoder.on('clear', (result) => {
+ console.log("Clear event triggered");
+ //Updates props.onGeocoderResult with an empty string and handles empty string value in FilterMenu for Blank Map Form Validation
+ this.props.onGeocoderResult({place_name: ''});
+ });
// this.setTab(GEO_FILTER_TYPES.address);
}
@@ -157,7 +164,7 @@ class MapSearch extends React.Component {
setTab = tab => {
this.props.onChangeTab(tab);
- this.geocoder.clear();
+ // this.geocoder.clear();
this.geocoder.setPlaceholder(`Enter ${tab.toLowerCase()}`);
switch(tab) {
case GEO_FILTER_TYPES.address: