Skip to content

Commit

Permalink
Added default date
Browse files Browse the repository at this point in the history
  • Loading branch information
Manohar-Gunturu committed Jan 3, 2018
1 parent 1888808 commit bf14137
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions calendar-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CalendarLite extends Polymer.GestureEventListeners(Polymer.Element){
return {
date: {
type: Date,
value: new Date()
},
currentMonth: {
type: Number
Expand Down Expand Up @@ -75,15 +76,18 @@ class CalendarLite extends Polymer.GestureEventListeners(Polymer.Element){
}

ready() {
// generate 6 x 7 table
super.ready(); // for 2.0 class-based elements only

// generate 6 x 7 table so each cell is a date and each row is a week
// it just works on the logic of how a wall calendar looks like.
this.generateTable();
this._animationEvent = this._whichAnimationEnd();


// in multiple date selection - insert today date if it in not in the disabled days list
if(!this.isDisabled(this.date.getDate())){
this.multiple.push(this.date.getDate()+","+this.date.getMonth()+","+this.date.getFullYear());
}
}

this.currentYear = this.date.getFullYear();
this.currentMonth = this.date.getMonth();

Expand Down Expand Up @@ -122,12 +126,7 @@ class CalendarLite extends Polymer.GestureEventListeners(Polymer.Element){
generateTable(){


// if date attribute is not set take today date
if(this.date == undefined){
this.date = new Date();
}

//clone into tmpDate
//create tmpDate from starting of this month
this.tmpDate = new Date(this.currentYear,this.currentMonth,1);

//tmpArray contains 6x7(42) items
Expand Down

0 comments on commit bf14137

Please sign in to comment.