mezoistvan / ng2-flatpickr

Angular 2+ wrapper for flatpickr (https://github.com/chmln/flatpickr)
100 stars 53 forks source link

ng2 flatpickr returns array #107

Open kavinGurusamy opened 3 years ago

kavinGurusamy commented 3 years ago

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>`
IbrahimAyed1 commented 2 years ago

I have the same issue when I used it as a FormControl in FormArray, but while using it in a FormGroup everything works fine

Fahad11-dev commented 1 year ago

you have to get bind (change)="getDate($event)" event to get formated date