I am using Angular 2 and trying to get a PrimeNG calendar datepicker to allow me to disable specific days (holidays) as well as weekends.
Their documentation says I should be able to do both and gives an example which I've tried to implement. However, no dates ever get disabled!
In my component template:
<p-calendar [(ngModel)]="requestedShipDate" name="requestedShipDate"
[disabledDates]="restrictedShipDates" [disabledDays]="[0,6]"></p-calendar>
In my component class (with some sample initialization code that I cannot get to work):
export class OrdersNewComponent implements OnInit {
requestedShipDate: Date;
restrictedShipDates: Array<Date>;
ngOnInit() {
let today = new Date();
let invalidDate = new Date();
invalidDate.setDate(today.getDate() - 1);
this.restrictedShipDates = [today,invalidDate];
}
}
Is there not a better angular 2 calendar datepicker out there that allows disabling specific dates? (not just minDate and maxDate)? This is the only one I've found with this feature and it of course doesn't work for me!
And in case it is a issue with some incompatabile packages or something, here are the dependencies from my project.json:
"dependencies": {
"@angular/common": "2.4.2",
"@angular/compiler": "2.4.2",
"@angular/core": "2.4.2",
"@angular/flex-layout": "2.0.0-beta.3",
"@angular/forms": "2.4.2",
"@angular/http": "2.4.2",
"@angular/material": "2.0.0-beta.2",
"@angular/platform-browser": "2.4.2",
"@angular/platform-browser-dynamic": "2.4.2",
"@angular/router": "3.4.2",
"angular2-select": "1.0.0-alpha.12",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
"jsrsasign": "6.1.1",
"jwt-decode": "2.1.0",
"lodash": "4.16.4",
"material-design-lite": "1.2.1",
"moment": "2.15.1",
"ng2-pagination": "0.5.1",
"ng2-translate": "4.0.0",
"normalize.css": "4.2.0",
"primeng": "1.1.4",
"rxjs": "5.0.3",
"ts-helpers": "1.1.1",
"xmljson": "0.2.0",
"zone.js": "0.7.4"
},
"devDependencies": {
"@angular/compiler-cli": "2.4.2",
"@types/jasmine": "2.5.38",
"@types/lodash": "4.14.37",
"@types/node": "6.0.42",
"angular-cli": "1.0.0-beta.25.5",
"angular2-perfect-scrollbar": "^2.0.6",
"codelyzer": "^2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.0.2",
"karma-remap-istanbul": "0.2.1",
"protractor": "4.0.13",
"ts-node": "1.2.1",
"tslint": "4.3.0",
"typescript": "2.0.10"
}