fingerpich / jalali-angular-datepicker

Highly configurable jalali (shamsi, khorshidi, persian) date picker built for Angular ( 2 or more ) applications
https://fingerpich.github.io/jalali-angular-datepicker/
MIT License
152 stars 60 forks source link

'closeOnSelect' not working on daytime mode. #114

Closed Rouhollah closed 4 years ago

Rouhollah commented 4 years ago

I am using Angular 7.1.0 and have already worked with Angular 6, but on both versions, the 'closeOnSelect' option does not work on daytime mode. I'm currently using 2.2.7 datePicker.

Rouhollah commented 4 years ago

sorry for this. in guide section for package , for this item of config , in the "Applies To" column has written just "day|month" and i didn't see. but i solved this issue with below way: in Html:

<dp-date-picker #dpPicker
                  [(ngModel)]="fromDate"
                  (onChange)="closeIt($event)"
                  mode="daytime"
                  placeholder="From date"
          theme="dp-material"
                  [config]="datePickerConfig">
    </dp-date-picker>

and in .ts file :

fromDate:any;
  @ViewChild("dpPicker") picker: DatePickerComponent;
  datePickerConfig: IDatePickerConfig = {
    format: "YYYY/MM/DD HH:mm",
    showTwentyFourHours: true,
  };
closeIt(event: CalendarValue) {
    document.onclick = (evt)=> {
      if (evt.target['className'].includes("dp-calendar-day"))
      setTimeout(()=>{
        this.picker.api.close();
      },0);
    };
  }

live demo. maybe i fork and solve this issue in future.

------------------update 2019/12/21 14:03----------------------- I tried to solve the problem. So I forked it and made some changes. This feature will be added to the new version if the author(fingerpich) accepts the changes.