Skip to content

Commit cc3d88f

Browse files
authored
Merge pull request #30 from nncl/1.9.1-alfa
1.9.1 alfa
2 parents 93d40b7 + b7dce82 commit cc3d88f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

projects/ngxdatepicker/src/lib/ngxdatepicker.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ export class NgxdatepickerComponent implements OnInit, ControlValueAccessor, OnC
221221
hasFoundEqual = day.isSame(this.validDates[i], 'day');
222222
}
223223

224-
obj.disabled = !hasFoundEqual;
224+
if (hasFoundEqual) {
225+
obj.disabled = day.isBefore(moment().startOf('day').format()) || !(currentMonth === day.format('M'));
226+
} else {
227+
obj.disabled = true;
228+
}
225229
}
226230

227231
days.push(obj);

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ <h4>{{ model4 }}</h4>
124124
<h2>Valid dates</h2>
125125

126126
<p>
127-
Today, tomorrow and the same to the next month are valid, all others are disabled.
127+
Today, tomorrow and the same to the next month with its first date as well are valid, all others are disabled.
128128
</p>
129129

130130
<pre>{{validDates | json}}</pre>

src/app/app.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ export class AppComponent implements OnInit {
3636
const today = moment().format();
3737
const oneMonthFromNow = moment().add(1, 'months').format();
3838
const oneMonthFromNowPlusOneDay = moment().add(1, 'months').add(1, 'days').format();
39+
const firstDayOfNextMonth = moment().add(1, 'months').startOf('month').format();
3940

4041
this.validDates = [
4142
today,
4243
tomorrow,
44+
firstDayOfNextMonth,
4345
oneMonthFromNow,
4446
oneMonthFromNowPlusOneDay
4547
];

0 commit comments

Comments
 (0)