Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add highlight-end and highlight-start classes to dayClasses
  • Loading branch information
g-wilson committed Sep 7, 2017
commit 07453fb195615a90e290faafec35df5dfc917aee
31 changes: 28 additions & 3 deletions src/components/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ export default {
isSelected: this.isSelectedDate(dObj),
isDisabled: this.isDisabledDate(dObj),
isHighlighted: this.isHighlightedDate(dObj),
isHighlightStart: this.isHighlightStart(dObj),
isHighlightEnd: this.isHighlightEnd(dObj),
isToday: dObj.toDateString() === (new Date()).toDateString(),
isWeekend: dObj.getDay() === 0 || dObj.getDay() === 6,
isSaturday: dObj.getDay() === 6,
Expand Down Expand Up @@ -624,10 +626,31 @@ export default {
},

/**
* Helper
* @param {mixed} prop
* Whether a day is highlighted and it is the first date
* in the highlighted range of dates
* @param {Date}
* @return {Boolean}
*/
isHighlightStart (date) {
if (!this.isHighlightedDate(date)) {
return false
}
return this.highlighted.from.getTime() === date.getTime()
},

/**
* Whether a day is highlighted and it is the first date
* in the highlighted range of dates
* @param {Date}
* @return {Boolean}
*/
isHighlightEnd (date) {
if (!this.isHighlightedDate(date)) {
return false
}
return this.highlighted.to.getTime() === date.getTime()
},

isDefined (prop) {
return typeof prop !== 'undefined' && prop
},
Expand Down Expand Up @@ -757,7 +780,9 @@ export default {
'today': day.isToday,
'weekend': day.isWeekend,
'sat': day.isSaturday,
'sun': day.isSunday
'sun': day.isSunday,
'highlight-start': day.isHighlightStart,
'highlight-end': day.isHighlightEnd
}
},

Expand Down