#Date is accepting 3 digit year
11 messages · Page 1 of 1 (latest)
<date-input [form]="form" control="dateOfLoss" minlength="10" label="Date Of Loss" col=6 ></date-input>
// your code here
selector: 'date-input',
template: `
<div [formGroup]="form" [ngClass]="{ 'form-group-inline' : _inline , 'ax-form-group' : true }">
<div class="label-line" [ngClass]="labelClass" *ngIf='label !== undefined'>{{label}}<span *ngIf="!!_required" class="required-text">*</span><span class="text-muted" *ngIf="help != null">{{help}}</span></div>
<div>
<ejs-datepicker
formControlName="{{control}}"
[min]='min'
[max]='max'
[enableMask]='true'
[maskPlaceholder]="{month: 'mm', day: 'dd', year: 'yyyy'}"
[placeholder]="placeholder ?? ('Enter ' + (label ?? 'date'))"
> </ejs-datepicker>
<print-error [control]="this.form.controls[control]"></print-error>
</div>
</div>
please help
Your date picker apparently has a min input. Presumably, it's the minimum data that can be entered into the date picker. So pass it the minimum date you want to accept: (i.e. the first of January of year 1000)?
Actually the min is already defined as
min: any = new Date(1910,1,1)
when I open the datepicker it is blocking the dates before the min and after the max to select
but I can still type the improper date as 11/11/111 in the date field
Then add a validator on the control, to display an an error if the entered date is not after year 1000. https://angular.io/guide/form-validation#defining-custom-validators
got it