This on drives me a little nuts. Maybe there is a simple fix.
When I am creating a form or table that is editable I am constantly having to create a transformer that converts "" to null for date fields. When I dont do this, if someone removes/clears a date from the table or clears a date in a form, or even just doesn't fill in a non required date in a from it throws a "" is not allowed for datefield error on the database. Can you please change the default behaviour, or add a checkbox that defaults the field to null instead of "".
I fix this using transformers, or inline js in my queries to replace "" with null but it is starting to feel very unnecessary, as I cannot see a reason a date field would return "". Maybe there is something else I am missing, if so, please let me know how to properly set up dates.
I don't think this would change any time soon, see this post from a retool member some time ago:
Something you could do is create a global function (if you have beta functionality enabled in your account) so you can recicle that each time with a simple function and not having to write inline js or transforfmers.
Do you know if retool shares the source code for their components? This would be great, as I could then just take the datepicker code and tweak it. Although this does show up in a lot of places...
Hey @ben_inkana - thanks for reaching out and advocating for this. I'll add your feedback to the internal conversation we use to track similar requests.
For context, the primary reason we built the component this way - and have resisted a significant overhaul - is that it aligns with the native behavior of an <input type='date' /> HTML element. One workaround that we've considered (and will likely implement) for a variety of such input components is an allowNull toggle that overrides this default behavior.
I'll update this thread as soon as I have any significant news to share!
It would be great if you did. I use a CAD software that does this and it is brilliant. They share the source code for how all of their default features are created and you can use that as a springboard to extend of develop your own. Here is an example - Standard Library Documentation
You can also see their documentation - it has a link to see the source code (you need an account to see it) Introduction
This allows for users to see best practices and extend the software with a great head start.