t1m0n/air-datepicker

Weekday selection?

rubjo opened this issue · 6 comments

rubjo commented

Hi,

And thanks for making and updating this very nice picker!

Would you consider adding the possibility of selecting weekdays for multiple dates mode? This would be a little different than collecting an array of dates, as it would just entail toggling seven Booleans by clicking on weekday headings and indicating it with CSS.

t1m0n commented

Hello! Thanks for your response and sorry for the long answer.
I don't quite understand what you mean - you want to be able to choose for example all Tuesdays when clicking on day name in calendar body?

rubjo commented

Yes, eg. all Saturdays and Sundays.

My use case for this is like so: A library needs to indicate what days are «red», ie. what days the library is closed and shouldn’t use for due dates for books etc. on. Typically, this would be weekends (esp. Sundays), national holidays and a handful other dates.

So to set this, it would be nice to use air-datepicker with multipledates and some option to allow weekday selection, so that the output from the picker could be (pseudo code):

{
dates: [date X, date Y…],
weekdays: [6, 7] // Saturdays & Sundays
}

Hope this makes sense. I already patched together this functionality for air-datepicker v2 myself, but it would be nice to have it in v3 as well, as I’d rather want to use that. :)

t1m0n commented

Hm, it seems to me adding onClick event on day names should resolve this issue?

rubjo commented

Well, yes, to resolve it, one should have a listener and then of course some styles to indicate which weekdays are selected.

So the issue is about having this functionality built into the library (because it could be useful to others as well), but yes, I could probably just implement it myself.

rubjo commented

Thanks for including this feature in the next milestone. Let me know if you need some help with it or a pull request.

And I would like to send all my very best wishes to you in what is and will be a difficult time for the people of your country, because of the actions of a few selfish men at the top. ❤️🇷🇺🕊🇺🇦❤️

t1m0n commented

Thank you for your support and kind words! 🙏Nobody wants this bloody war, I hope this horror will end up soon.