Problem/Motivation
I was having the same issue as #3425255: The field appears as a simple text field. but I was not seeing any JS errors. I even tried on simplytest.me and used the exact example config provided (with dates modified to be in future), but no luck. I did notice that get-days endpoint was calling the last day of the previous month instead of the first day of the desired month, but didn't guess it was timezone unfortunately until after a bunch of debugging.
Eventually went through the JS line by line and figured out that the problem occurs when the date is converted to ISO time, which defaults to UTC. And for most of the day in Australia, it's actually the previous day in UTC. Hence monthStart getting the end date for the month before.
Maybe this screenshot helps to explain it, my brain is fried!

Note that this is based on the browser setting, not the site setting. If I changed my computer to US East Coast, the widget works.
Steps to reproduce
I *think* you should be able to reproduce this by changing your computer to Brisbane, Australia and trying https://master-ebbfycdpwp8uptzb57xkfyeloikoo5bx.tugboatqa.com/form/test in the European evening, after it has passed midnight in Australia.
Proposed resolution
I am really not sure because converting the date to UTC earlier will probably result in the same issue? So I think the only solution is to avoid use of toISOString()?
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Screenshot 2024-09-06 at 2.30.54 pm.png | 11.22 KB | pameeela |
Comments
Comment #2
pameeela commentedUpdated with a more clarifying screenshot
Comment #3
zartab farooquee commentedInstead of using toISOString(), which converts the date to UTC, you can rely on JavaScript's Date() object to work with local time.
Comment #5
rfmarcelino commented@pameeela Thank you for your feedback.
I just sent a commit to change how the date is processed.
Install the dev version:
composer require 'drupal/webform_booking:1.0.x-dev@dev'and let me know if it solved your issue
Comment #6
pameeela commentedThank you! Yes it works perfectly :)
Comment #7
rfmarcelino commented