Error when trying to search for rooms to book

I also have development site that is having the same issue. I pulled the latest updates last night from the repo. I get this extra warning in DevTools about the updating “DateInput”. Not sure if that’s related to the issue:

The DateInput stuff is unrelated.

Could you test if changing the system locale (of your desktop, not of the server) to something like en-GB or en-US changes the behavior? I don’t see why that would help but it’s the only thing I could vaguely imagine…

No, that didn’t fix it, I tried US and British english and even Spanish, but still the same issue

Really really weird. But if you can reproduce it on a dev instance, it’s time to fire up your browser’s devtools and debugger.

Apply this patch to the code (make sure the build-assets.py script is running so the JS bundle gets recompiled) and then use the debugger from your browser’s dev tools to step into the validation code and see where it fails:

diff --git a/indico/modules/rb/client/js/common/roomSearch/queryString.js b/indico/modules/rb/client/js/common/roomSearch/queryString.js
index 26727b98fd..917a5f5a9d 100644
--- a/indico/modules/rb/client/js/common/roomSearch/queryString.js
+++ b/indico/modules/rb/client/js/common/roomSearch/queryString.js
@@ -48,7 +48,12 @@ export const rules = {
     stateField: 'filters.recurrence.interval',
   },
   sd: {
-    validator: v.isDate(),
+    validator: value => {
+      debugger;
+      const res = v.isDate()(value);
+      console.log(`validating ${value} => ${res}`);
+      return res;
+    },
     stateField: 'filters.dates.startDate',
   },
   ed: {

ah, maybe you need to enable “stop at breakpoints” or similar in the debugger pane of the devtools

Could the issue be on line 106 of isDate.js

return new Date("".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d)).getDate() === +dateObj.d;

for a parameter list of:
rooms/book?recurrence=single&number=1&interval=week&sd=2024-04-11&st=12%3A00&et=13%3A00
this will translate to:

new Date("".concat("2024", "-").concat("04, "-").concat("11").getDate() 
new Date("2024-04-11").getDate()

which returns 10 for us

but then +dateObj.d has a value of 11, so the function returns false

I also made these 2 changes to the queryString.js file: (daily booking from one date to another was not working either)

image

and that worked.

That disables the validation. It’s a workaround that does not fix the underlying problem…

v.isDate() returns the actual validation function, so by setting the validator to value => v.isDate(value) it always passes because you aren’t actually validating the value but looking at a function which is always true when used in a boolean context…

I see.
Then I think the problem is related to a timezone issue with the javascript Date function. This line in the isDate.js script:

return new Date("".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d)).getDate() === +dateObj.d;

always returns false for us.
As you can notice above on the devtools screenshot:

dateObj = {d: "11", m:"04", y:"2024"}}

but the expression below results in a value of 10:

new Date("".concat(fullYear, "-").concat(dateObj.m, "-").concat(dateObj.d)).getDate()

e.g.

new Date("2024-04-11").getDate()

image

I found this issue posted for validator.js. It looks like the problem we’re having:

OK, that explains it. I recently updated the dependencies of redux-router-querystring which included updating validator. If they don’t make a bugfix release downgrading that dependency to the previous release (and making a new release of our r-r-q package) should be straightforward enough, that fix would be included in Indico v3.3.2.

Great, sounds good. Thanks!

I just pushed a fix to master. Can you please try and see if the bug is fixed? You need to run npm ci to update the deps, alternatively you can of course just run npm update redux-router-querystring to get v0.1.1 which downgraded validator.

Fixed! Thank you for this update TM.
Do you have an ETA on when Indico v3.3.2 will be released with this update?
Cheers

I’ve just been waiting for your confirmation that this fixes that problem. So probably tomorrow.

Edit: Didn’t have the time today, so Wednesday it is.

Perfect! thanks again

v3.3.2 is out now.

Thank you