hsuanxyz / ion2-calendar

📅 A date picker components for ionic2 /ionic3 / ionic4
https://hsuanxyz.github.io/demo/ion2-calendar/
MIT License
555 stars 278 forks source link

Can't select dates on iPhone. #255

Open obkdev opened 5 years ago

obkdev commented 5 years ago

Ionic version: (check one with "x") [ ] 2.x [x] 3.x [ ] 4.x

Ion2-calendar mode: (check one with "x") [ ] components mode [x] modal mode

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [x] help me

Current behavior: Built an ionic app. Running the app on android and iphone real devices. Android works perfectly. iPhone I can't select any dates and the disabled days look the same as the selectable days.

Expected behavior: I expect iPhone and Android to be pretty much the same. I expect to be able to select dates on iPhone.

Steps to reproduce: Run the app on an iPhone. The same code works correctly on Android but not on iPhone.

Related code:

openCalendar() {
    console.log('openCalendar()');
    let today = new Date();
    let startDate = new Date().setMonth(today.getMonth() - 1);
    let endDate = new Date().setMonth(today.getMonth() + 1);

    const options: CalendarModalOptions = {
      title: 'Select Dates',
      pickMode: 'multi',
      canBackwardsSelected: true,
      defaultDateRange: { from: startDate, to: endDate },
      defaultDates: this.dates,
      to: new Date()
    };
    let myCalendar = this.modalController.create(CalendarModal, {
      options: options
    });

    myCalendar.present();

    myCalendar.onDidDismiss((dates: Array<CalendarResult>, type: string) => {
      console.log('Dates back from modal: ', dates);   });
  }

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Ionic:

   Ionic CLI          : 5.2.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.2

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, (and 25 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.7 

System:

   Android SDK Tools : 26.1.1 (/Users/travis.bradfield/Library/Android/sdk)
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.1
   NodeJS            : v10.15.0 (/usr/local/bin/node)
   npm               : 6.9.2
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001