question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ion-datetime min/max not working as expected

See original GitHub issue

Bug 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:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MrSparkllecommented, Aug 30, 2018

@jordanpurinton update your Ionic to beta 6. This issue has been fixed.

1reaction
jordanpurintoncommented, Aug 30, 2018

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 or min max set, by default the component doesn’t default to showing 2018.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found