Skip to content

Commit

Permalink
Added isInMonth method
Browse files Browse the repository at this point in the history
  • Loading branch information
GramThanos committed Aug 3, 2017
1 parent 733f819 commit 7221cf3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions source/jsCalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,34 @@ var jsCalendar = (function(){
}
};

// Check if date is in active month
JsCalendar.prototype.isInMonth = function(date){
// If no arguments or null
if (typeof date === "undefined" || date === null) {
// Return
return false;
}

// Parse date and get month
month = this._parseDate(date);
month.setHours(0, 0, 0, 0);
month.setDate(1);

// Parse active month date
active = this._parseDate(this._date);
active.setHours(0, 0, 0, 0);
active.setDate(1);

// If same month
if (month.getTime() == active.getTime()) {
return true;
}
// Other month
else {
return false;
}
};

// Set language
JsCalendar.prototype.setLanguage = function(code) {
// Check if language exist
Expand Down

0 comments on commit 7221cf3

Please sign in to comment.