Skip to content

ion-datetime min/max not working as expected #15312

@jordanpurinton

Description

@jordanpurinton

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions