Skip to content
Open
Changes from all commits
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
6 changes: 5 additions & 1 deletion timeframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ var Timeframe = Class.create({
this.weekOffset = this.options.get('weekOffset') || Locale.get('weekOffset');
this.maxRange = this.options.get('maxRange');

this.selectableDays = this.options.get('selectableDays') || new Array(0, 1, 2, 3, 4, 5, 6);

this.firstDayId = this.element.id + '_firstday';
this.lastDayId = this.element.id + '_lastday';

Expand Down Expand Up @@ -132,7 +134,7 @@ var Timeframe = Class.create({
calendar.select('td').each(function(day) {
day.date = new Date(iterator); // Is this expensive (we unload these later)? We could store the epoch time instead.
day.update(day.date.getDate()).writeAttribute('class', inactive || 'active');
if ((this.earliest && day.date < this.earliest) || (this.latest && day.date > this.latest))
if ((this.earliest && day.date < this.earliest) || (this.latest && day.date > this.latest) || !this.selectableDays.include(day.date.getDay()))
day.addClassName('unselectable');
else
day.addClassName('selectable');
Expand Down Expand Up @@ -284,6 +286,8 @@ var Timeframe = Class.create({
error = 'soft';
else if (fieldName == 'end' && this.range.get('start') && date < this.range.get('start'))
error = 'soft';
else if (!this.selectableDays.include(date.getDay()))
error = 'hard';
return error;
},

Expand Down