Highlight dates from selection to hover position

This would be useful on a calendar when selecting a range between two dates.

View the demo

How does it work?

Firstly I add an index to each table cell using a data attribute.

A function that triggers on hover of a table cell checks whether the first date has been selected. At its simplest, using slice I add the class .hovering to those indexes between the selected and hover.