role="alert"
class="alert alert-danger">
<span class="material-icons">error</span>
- {{firstError(controlDir.control.errors)}}
+ {{firstError(controlDir.control.errors)}}
</div>
<ngb-datepicker #datePicker
+ [minDate]="minDate"
+ [maxDate]="maxDate"
formControlName="date"
[footerTemplate]="time"
(touch)="onTouched()">
import {NgbDatepicker, NgbTimeStruct, NgbDateStruct} from '@ng-bootstrap/ng-bootstrap';
import {DatetimeValidator} from '@eg/share/validators/datetime_validator.directive';
import * as moment from 'moment-timezone';
+import {DateUtil} from '@eg/share/util/date';
@Component({
selector: 'eg-datetime-select',
@Input() showTZ = true;
@Input() timezone: string = this.format.wsOrgTimezone;
@Input() readOnly = false;
+ @Input() noPast = false;
+ @Input() noFuture = false;
+ @Input() minDate: any;
+ @Input() maxDate: any;
@Output() onChangeAsIso: EventEmitter<string>;
dateTimeForm: FormGroup;
}
ngOnInit() {
+ if (this.noPast) {
+ this.minDate = DateUtil.localYmdPartsFromDate();
+ }
+ if (this.noFuture) {
+ this.maxDate = DateUtil.localYmdPartsFromDate();
+ }
if (!this.timezone) {
this.timezone = this.format.wsOrgTimezone;
}