Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Determine which custom Class was set on the clickedDate #11

Open
4pr3x opened this issue Jun 28, 2016 · 5 comments
Open

Determine which custom Class was set on the clickedDate #11

4pr3x opened this issue Jun 28, 2016 · 5 comments

Comments

@4pr3x
Copy link

4pr3x commented Jun 28, 2016

Hey,

first of all thank you very much for sharing this awesome project.
I would love to have the option to determine which custom Class/Classes are set on the selected Day. If this would be enabled by default, it would help to make this Calendar much more attractive for non static use-cases.

Currently I´m searching for the class selected

var select = document.getElementsByClassName('selected');
console.log(select[0].classList)

and do my stuff. But a cleaner, more usable way would be awesome.

Thanks

@GiovanniFrigo
Copy link
Member

Hello @4pr3x,

I can surely expose the classes of the selected day in the onDatePicked callback! It could be a string that contains the assigned html classes passed as second argument to the callback. Would that work for you?

Do you think this could also have some use even in the onPickRange callback? I'm not sure that really makes sense, as the user could have selected different days with much different classes, and none in common. Any thought on this?

@4pr3x
Copy link
Author

4pr3x commented Jun 29, 2016

Hey @GiovanniFrigo,

thank you for the quick response. A string containing the assigned html classes would work for me even if I would prefer an object therefore I would´t have to split it on my own, but this is just relevant for my specific use-case ;) But I see the argument for a string!

I have a use-case where the classes would also be relevant for onPickRange. Imagine you have inserted some "events/ Meetings" and a user selects a dateRange. If the classes would be exposed you could make a little legend outside of the calendar to show the user which events take place within that range. This is especially relevant if on one or more dates are several events (classes) that can´t be displayed with different colors on the calendar. So I would prefer to expose the classes on both events.

@GiovanniFrigo
Copy link
Member

I have a use-case where the classes would also be relevant for onPickRange. Imagine you have inserted some "events/ Meetings" and a user selects a dateRange. If the classes would be exposed you could make a little legend outside of the calendar to show the user which events take place within that range. This is especially relevant if on one or more dates are several events (classes) that can´t be displayed with different colors on the calendar. So I would prefer to expose the classes on both events.

Any idea on how to pass out the classes for multiple days in a way that is convenient to use? Maybe an object mapping classes for each day? An array of strings?

GiovanniFrigo pushed a commit that referenced this issue Jul 2, 2016
See Issue #11: Determine which custom Class was set on the clickedDate
@GiovanniFrigo
Copy link
Member

I've implemented the classes passing for single days for now, it is available in npm version 1.1.4.

@4pr3x
Copy link
Author

4pr3x commented Jul 4, 2016

Great to hear! Thanks for the quick implementation, looks good.

Any idea on how to pass out the classes for multiple days in a way that is convenient to use? Maybe an object mapping classes for each day? An array of strings?

Both would work for me. Guess an array of strings would be good.

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants