Skip to content

Commit

Permalink
feat: added ability to set max and min date value inside input component
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoninoBonanno authored and astagi committed May 15, 2023
1 parent dff8a25 commit c2ec250
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<input *ngIf="type !== 'number'"
[id]="id"
[type]="type"
[max]="type === 'date' ? maxDate : undefined"
[min]="type === 'date' ? minDate : undefined"
[class.form-control]="readonly !== 'plaintext'"
[class.form-control-plaintext]="readonly === 'plaintext'"
[class.is-invalid]="isInvalid"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ export class InputComponent extends AbstractFormComponent<string | number> imple
*/
@Input() readonly?: BooleanInput | 'plaintext';

/**
* The max date value [Used only in type = 'date']
* @default '9999-12-31'
* @example 'yyyy-mm-dd'
*/
@Input() maxDate?: string;

/**
* The min date value [Used only in type = 'date']
* @example 'yyyy-mm-dd'
*/
@Input() minDate?: string;

/**
* The max value [Used only in type = 'number']
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ <h5>Datepicker</h5>

<it-input type="date" label="Datepicker"></it-input>

<h5>Limiti</h5>
<p class="mb-5">Aggiungendo le proprietà "min" e "max" all'input è possibile limitare la data minima e massima del campo</p>

<!-- Input date con min, max e step -->
<it-input type="date"
label="Min, Max"
minDate="2020-05-07" maxDate="2025-05-07"></it-input>

</div>

0 comments on commit c2ec250

Please sign in to comment.