Skip to content

Commit

Permalink
feat: add allowInvalidPreload input (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: David Baines <[email protected]>
  • Loading branch information
dbaines and David Baines authored Apr 26, 2023
1 parent 6ca8e82 commit 33d5d24
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions projects/angularx-flatpickr/src/lib/flatpickr-defaults.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export interface FlatpickrDefaultsInterface {
*/
allowInput?: boolean;

/**
* Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
*/
allowInvalidPreload?: boolean;

/**
* Instead of `body`, appends the calendar to the specified node instead.
*/
Expand Down Expand Up @@ -247,6 +252,11 @@ export class FlatpickrDefaults implements FlatpickrDefaultsInterface {
*/
allowInput: boolean = false;

/**
* Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
*/
allowInvalidPreload: boolean = false;

/**
* Instead of `body`, appends the calendar to the specified node instead.
*/
Expand Down
7 changes: 7 additions & 0 deletions projects/angularx-flatpickr/src/lib/flatpickr.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ export class FlatpickrDirective
*/
@Input() allowInput: boolean;


/**
* Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
*/
@Input() allowInvalidPreload: boolean;

/**
* Instead of `body`, appends the calendar to the specified node instead.
*/
Expand Down Expand Up @@ -357,6 +363,7 @@ export class FlatpickrDirective
altInput: this.altInput,
altInputClass: this.altInputClass,
allowInput: this.allowInput,
allowInvalidPreload: this.allowInvalidPreload,
appendTo: this.appendTo,
ariaDateFormat: this.ariaDateFormat,
clickOpens: this.clickOpens,
Expand Down

0 comments on commit 33d5d24

Please sign in to comment.