serverSide + SearchBuilder + luxon throwing a type error
serverSide + SearchBuilder + luxon throwing a type error
Link to test case: http://live.datatables.net/pajijiha/1/
Debugger code (debug.datatables.net): https://debug.datatables.net/amejav
Error messages shown: Uncaught TypeError: Cannot read properties of null (reading 'toString')
Description of problem:
When serverSide is set to true and the time zone token is included in the searchBuilderType eg: luxon-MM/dd/yyyy hh:mm:ss ZZZZ
, an error is thrown.
- Click on Add Condition
- Set Data to Start date
- Pick any condition
- Pick a date/time
- An error is thrown
A workaround is to simply drop the timezone token from the format string or use ZZ which works fine. Is this a limitation that should be documented or a bug that needs to be fixed?
Answers
Hi @arthur_taxcycle ,
I've updated your example to use the latest nightly build for SearchBuilder. This just makes things a bit easier to debug.
The issue here is that the DateTime picker for me is producing
GMT+1
. This is not a format that Luxon is able to parse, but it is a valid timezone. I've raised an issue internally (DD-2359 for my reference) and will report back here when there is an update.Thanks,
Sandy
Hi @arthur_taxcycle ,
I've discussed with Allan and at the moment DateTime is only compatible with UTC. We do have some ideas to make it possible to use timezones properly in the future, but at the moment this is not possible. If you can manage without using timezones then that is the way to do it.
Thanks,
Sandy
Hello,
Is there a way to show date/time on the UI but epoch timestamp in a string when sending the data? Do I need to hook into the ajax call?
Also possibly related, datatables.ajax.reload() also throws an exception regardless of whether the timezone is in the format or not. Here is the sandbox link.
Thanks,
Arthur
You should be able to use orthogonal data for that different rendering to what was sent - see example here.
I'm not sure about the
ajax.reload()
error - your test case doesn't generate an error for me. Can you link to a test case that demonstrates the error, please.Colin
Hello,
I apologize for not including the entire reproduction steps.
A similar issue occurs when using the moment library. live.datatables.net/kotuyuxu/1/edit
Hello all,
Thanks for your help! I was able to debug and fix the issues I was experiencing with the searchbuilder extension.
The change can be found here.
Regards,
Arthur