Skip to content

Instantly share code, notes, and snippets.

@armorpreston
Last active May 6, 2020 14:34
Show Gist options
  • Save armorpreston/7f70a920e05b605f686412015f19f82a to your computer and use it in GitHub Desktop.
Save armorpreston/7f70a920e05b605f686412015f19f82a to your computer and use it in GitHub Desktop.
Disabling Dates
<date-picker [markDisabled]="markDateDisabled.bind(this)"></date-picker>
export class DatePickerExamplesComponent {
public now = new Date();
public today: NgbDate = new NgbDate(this.now.getFullYear(), this.now.getMonth() + 1, this.now.getDate());
public markDateDisabled(date: NgbDate): boolean {
// Disable dates before today – date.after(this.today) is also available
return date.before(this.today);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment