-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to select dates before today in Ionic 6 #347
Comments
Hello, I have the same problem, were you able to solve it? |
I found it is working for Ionic 6. You just need to set the to: date to be a future date. For example: |
I took this approach to get it working:
|
I found that the "minimum" from date is 1971 const options: CalendarModalOptions = {
title: '',
from: new Date(1971, 0, 1),
to: 0,
defaultDate: new Date(),
}; If you set before 1971 it will show all elements as a disabled const options: CalendarModalOptions = {
title: '',
from: new Date(1970, 0, 1),
to: 0,
defaultDate: new Date(),
}; |
Unfortunately this repository was abandoned, to solve my problems with dates before 1970 and updates, I released a new version with corrections and new features. |
Ionic version: (check one with "x")
[ ] 2.x
[ ] 3.x
[ ] 4.x
Ion2-calendar mode: (check one with "x")
[ ] components mode
[ ] modal mode
I'm submitting a ... (check one with "x")
[ ] bug report
[ ] feature request
[ ] help me
Current behavior:
Expected behavior:
Allow user select days starting from defined date in options value
Steps to reproduce:
I added
ion2-calendar
to an Ionic 6 project, but cannot make it select a date before the current date. Settingfrom
tonew Date('01/01/1970')
does nothing, and just disables selecting any day at all. Is this library compatible with Ionic 6?Related code:
Ionic:
Ionic CLI : 6.19.1 (C:\Users\robot\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.1.8
@angular-devkit/build-angular : 13.2.6
@angular-devkit/schematics : 13.2.6
@angular/cli : 13.2.6
@ionic/angular-toolkit : 6.1.0
Capacitor:
Capacitor CLI : 3.5.1
@capacitor/android : 3.5.1
@capacitor/core : 3.5.1
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : 1.6.0
System:
NodeJS : v16.15.0 (C:\Program Files\nodejs\node.exe)
npm : 8.5.5
OS : Windows 10```
Screenshot:
The text was updated successfully, but these errors were encountered: