wakirin / Litepicker

Date range picker - lightweight, no dependencies
MIT License
899 stars 132 forks source link

Different CSS for past dates #174

Closed mijrs closed 3 years ago

mijrs commented 3 years ago

Describe the bug Different CSS color for past dates, not the same as lockDays. This is ugly.

I use lockedDays for blocking booked dates (in red). Dates in the past have the same CSS class name. I would like to color them gray, but therefor you need a unique/other css class name for past dates.

To Reproduce https://jsfiddle.net/Mijrs/2htfd1oy/8/

Expected behavior Give dates in the past a different CSS class name. I would like to color them gray.

wakirin commented 3 years ago

At now you can do something like that:

...
setup: (picker) => {
  picker.on('render:day', (day, date) => {
    if (date.toJSDate() < today) {
      day.classList.add('is-past-day');
    }
  });

  if (picker.options.inlineMode) {
    picker.render();
  }
}
...

https://jsfiddle.net/aczg0rb2/

Perhaps in future releases I will add a class to determine the days that have passed.

mijrs commented 3 years ago

Thanks for the quick work around!

Hope it will get a structural solution in the future.