- Issue created by @dahousecat
- π¬π§United Kingdom dahousecat
Example data-disabled-dates attribute:
data-disabled-dates="2024-12-17,2024-12-18,2024-12-19,2024-12-25,2024-12-26"
- πΊπΈUnited States jrockowitz Brooklyn, NY
I would not want to support individual options; instead, I'd like to make it easier for people (aka developers) to define custom options to a webform element.
Attached is a POC (untested) approach that adds support to
data-options="{}"
thedata-options
would always be applied last. This could become a universal solution that allows developers to define element-specific custom JS options.The approach you could take would be something like...
data-options="{'beforeShowDay': my_custom_before_show_data'}"
function. my_custom_before_show_data(date) { // Ideally, you could pull the dates from the input's 'data-disabled-dates.' const dates = ['2024-12-17', '2024-12-18' , '2024-12-19' ]; const formatted = date.toISOString().split('T')[0] return [!dates.includes(formatted)]; };
New features will only be added to 6.3.x
- π¬π§United Kingdom dahousecat
I think that approach sounds very wise.
The patch I have will solve my use case for now, but once this feature gets added I can delete my patch :) - πΊπΈUnited States jrockowitz Brooklyn, NY
Let's leave this open because I think #5 needs to happen for most webform element libraries.
- πΊπΈUnited States jrockowitz Brooklyn, NY
@see π Allow custom data-options to added to elements JavaScript options Active