ng2-flatpickr
ng2-flatpickr copied to clipboard
ng2 flatpickr returns array
Hi why did flatpickr sends array as input to server. I am using it in angular reactive forms when i submit a form it does not bind my formatting options and return output as array.
` exampleOptions: FlatpickrOptions = {
allowInput: true,
dateFormat: "Y-m-d G:i:S K",
enableTime: true,
altFormat: "Y-m-d G:i:S K",
altInput: true,
formatDate: (date: string) => {
return moment(date).format("YYYY-MM-DD hh:mm:ss a");
}
}`
`
<label for="end"> EndTime </label>
<ng2-flatpickr type="text" id="end" name="end" [config]="exampleOptions" formControlName="endDateTime" placeholder="Enter end time"></ng2-flatpickr>
</div>`
I have the same issue when I used it as a FormControl in FormArray, but while using it in a FormGroup everything works fine
you have to get bind (change)="getDate($event)" event to get formated date