ion-datetime min/max not working as expected
See original GitHub issueBug Report
Ionic Info
Ionic:
ionic (Ionic CLI) : 4.1.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.3
@angular-devkit/core : 0.7.4
@angular-devkit/schematics : 0.7.4
@angular/cli : 6.1.4
@ionic/ng-toolkit : 1.0.6
@ionic/schematics-angular : 1.0.5
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)
System:
Android SDK Tools : 26.1.1 (/home/jordan/Android/Sdk)
NodeJS : v8.10.0 (/usr/bin/node)
npm : 6.3.0
OS : Linux 4.15
Describe the Bug
When I try to pass in a variable for the max
on ion-datetime, I’m greeted with this error message:
zone.js:665 Unhandled Promise rejection: Cannot read property 'year' of null ; Zone: <root> ; Task: null ; Value: TypeError: Cannot read property 'year' of null
This is what my ion-datetime
looks like:
<ion-datetime display-format="MMMM, D, YYYY" max="today"></ion-datetime>
This is what my today
variable looks like:
today = moment().format('YYYY-MM-DD');
How can I solve this and pass my variable to the ion-datetime
and not run into this issue?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Ion-datetime v6 [min] [max] value doesn't work as expected ...
hello,. i'm using the lastest ion-datetime component and i've faced the following issue: if i choose a min value as starting date, ...
Read more >ion-datetime min/max not working as expected #15312 - GitHub
The <ion-datetime> can't pick any date of 2018. If you tried to set any 2018 date to min or max, it raises a...
Read more >ion-datetime problem with value changing when max and min ...
It is a bug from the Ionic V3 ion-datetime component, and I see that the issue never was fixed. Expected behavior: When the...
Read more >Angular and Ionic Date & Time Min & max values Example
Configuring minimum and maximum selectable values is great for reducing mistakes. Help people by limiting the selections for the task at hand.
Read more >Ionic 4 datetime max and min not working properly and bad UX
Hello, I have problems with ion-datetime min and max values, In ionic 3 when you specify min and max dates when you press...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jordanpurinton update your Ionic to beta 6. This issue has been fixed.
Hey @brandyscarney , thanks for the reply. I can bind to
today
just fine, however, as outlined by previous posts, the component cannot display a year past 2017. Event without any ormin
max
set, by default the component doesn’t default to showing 2018.