Skip to content

Commit

Permalink
Tap date to go to today
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Ng committed Feb 24, 2014
1 parent 3c15b3f commit c93539c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions day-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ DayPicker = ribcage.extend({
}
, events: {
'click .leftArrow': 'previousDay'
, 'click .date': 'today'
, 'click .rightArrow': 'nextDay'
}
, className: 'ribcage-day-picker'
Expand All @@ -25,6 +26,15 @@ DayPicker = ribcage.extend({
this.$('.date').text(this.context().date);
this.handleRightArrow();

this.trigger('change', this.currentTime.getTime());
}
, today: function (e) {
e.preventDefault();

this.currentTime.setTime(this.getToday());
this.$('.date').text(this.context().date);
this.handleRightArrow();

this.trigger('change', this.currentTime.getTime());
}
, nextDay: function (e) {
Expand Down

0 comments on commit c93539c

Please sign in to comment.