Add data-date attribute to calendar month #59
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've got similar problems to the ones outlined in #54, where I'd like to be able to have different styles for each date based on an external condition.
I figured given the last comment on that thread indicates it might be tricky to get right, that it might take some time for a good solution to arrive for that. It might help in the meantime if there was a more reliable attribute on the calendar we could grab onto via the shadow root.
This PR adds a
data-date="YYYY-MM-DD"
attribute to each button in the calendar, such that you can script in your own styles as you please by committing some crimes against the shadow root, i.e.I can sort of do all of this with the aria label already, but it doesn't have the year in it and may be subject to localisation issues. At least with an ISO date, I have a slightly more reliable thing I can grab on to.
The above demonstration code is pretty hacky, but this change allows the hacks to live entirely in my app, not cally, which I can live with as it does at least let me do what I need without having to ask too many compromises of cally in the near term, while a longer term solution is conceived in #54.