Skip to content
Permalink
Browse files

add blackout class to day nodes & cleanup klass section

It is simply a bit easier to read and debug when you break these arguments into two lines.
  • Loading branch information...
Corey Holland
Corey Holland committed Oct 24, 2015
1 parent 120b579 commit 35f21cc0b5fe603be8096cfaed72c2b11040af4e
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/main.js
@@ -286,6 +286,7 @@ Kalendae.prototype = {
dayActive :'k-active',
daySelected :'k-selected',
dayInRange :'k-range',
dayBlackout :'k-blackout',
dayToday :'k-today',
monthSeparator :'k-separator',
disablePreviousMonth :'k-disable-previous-month-btn',
@@ -530,15 +531,22 @@ Kalendae.prototype = {

if (s) klass.push(({'-1':classes.dayInRange,'1':classes.daySelected, 'true':classes.daySelected})[s]);

if (day.month() != month.month()) klass.push(classes.dayOutOfMonth);
if (day.month() != month.month())
klass.push(classes.dayOutOfMonth);
else klass.push(classes.dayInMonth);

if (!(this.blackout(day) || this.direction(day) || (day.month() != month.month() && opts.dayOutOfMonthClickable === false)) || s>0) klass.push(classes.dayActive);
if (!(this.blackout(day) || this.direction(day) || (day.month() != month.month() && opts.dayOutOfMonthClickable === false)) || s>0 )
klass.push(classes.dayActive);

if (day.clone().startOf('day').yearDay() === today.yearDay()) klass.push(classes.dayToday);
if (this.blackout(day))
klass.push(classes.dayBlackout);

if (day.clone().startOf('day').yearDay() === today.yearDay())
klass.push(classes.dayToday);

dateString = day.format(this.settings.dayAttributeFormat);
if (opts.dateClassMap[dateString]) klass.push(opts.dateClassMap[dateString]);
if (opts.dateClassMap[dateString])
klass.push(opts.dateClassMap[dateString]);

$span.innerHTML = day.format(opts.dayNumberFormat);
$span.className = klass.join(' ');

0 comments on commit 35f21cc

Please sign in to comment.
You can’t perform that action at this time.