Add class to selectable start and stop element

Add class to selectable start and stop element

Hi,

i need a availability calendar. This is what i have now:

https://jsfiddle.net/6wfjm939/4/

So now i need to add a class "first" to the first selected day and a class "last" to the last selected day.

For axample:
I select 10, 11, 12, 13 then the on 10th should be added class "first" and on 13th "last.
If i select only 10, then 10th got "first" and 11th "last".

With this i want to mark check-in and check-out date.

UPDATE: Because its a multiselect i need the class "first" and "last" at evary range selected.

Hope someone can help me.

Thanks
Markus