Skip to content

Commit

Permalink
Merge branch 'hotfix/0.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
fetrarij committed May 9, 2018
2 parents 5ef3dcd + bcdc83e commit b6d0ee9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions demo/src/app/reactive-form/reactive-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h4>Reactive forms: with validators</h4>
<form [formGroup]="form">
<div class="col-md-6">
<div class="form-group">
<div class="input-group" [ngClass]="{'has-error': form.get('start').errors}">
<div class="input-group" [ngClass]="{'has-error': form.get('start').errors && form.get('start').touched}">
<input class="form-control"
a2e-datetimepicker
formControlName="start"
Expand All @@ -17,7 +17,7 @@ <h4>Reactive forms: with validators</h4>
</div>
<div class="col-md-6">
<div class="form-group">
<div class="input-group" [ngClass]="{'has-error': form.get('end').errors}">
<div class="input-group" [ngClass]="{'has-error': form.get('end').errors && form.get('end').touched}">
<input class="form-control"
a2e-datetimepicker
formControlName="end"
Expand All @@ -38,6 +38,8 @@ <h4>Reactive forms: with validators</h4>

<button class="btn btn-default" (click)="startReset()">Clear start date</button>
<button class="btn btn-default" (click)="endReset()">Clear end date</button>
<button class="btn btn-default" (click)="form.disable()">Disable dates</button>
<button class="btn btn-default" (click)="form.enable()">Enable dates</button>
</form>
</div>
</div>
5 changes: 3 additions & 2 deletions demo/src/app/reactive-form/reactive-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export class ReactiveFormComponent implements OnInit {
endOptions: any = {format: 'DD/MM/YYYY'};
constructor(fb: FormBuilder ) {
this.form = fb.group({
start: [moment('2015-11-18T00:00Z'), Validators.required ],
end: [moment('2015-11-24T00:00Z'), Validators.required ],
start: [moment('2015-11-18T00:00Z'), Validators.required],
end: [moment('2015-11-24T00:00Z'), Validators.required],
test: ''
});
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng2-eonasdan-datetimepicker",
"version": "0.1.2",
"version": "0.1.3",
"description": "Angular2+ component for bootstrap-datetimepicker library.",
"keywords": [
"angular2",
Expand Down
7 changes: 7 additions & 0 deletions src/datetimepicker.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ export class DateTimePickerDirective implements OnInit, OnDestroy, DoCheck {
this.datepicker.clear();
}
}
setDisabledState(isDisabled: boolean): void {
if (isDisabled) {
this.datepicker.disable();
return;
}
this.datepicker.enable();
}

ngOnInit(): void {
this.dpinitialized = true;
Expand Down

0 comments on commit b6d0ee9

Please sign in to comment.