Skip to content

Commit

Permalink
add blackout class to day nodes & cleanup klass section
Browse files Browse the repository at this point in the history
It is simply a bit easier to read and debug when you break these arguments into two lines.
  • Loading branch information
Corey Holland committed Oct 24, 2015
1 parent 120b579 commit 35f21cc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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(' ');
Expand Down

0 comments on commit 35f21cc

Please sign in to comment.