ionic-team / ionic-v3

The repo for Ionic 3.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
127 stars 85 forks source link

ion-datetime is always invalid after form submit when max attribute is used with HH:mm #664

Open ionitron-bot[bot] opened 5 years ago

ionitron-bot[bot] commented 5 years ago

Original issue by @sebastian-zarzycki-es on 2018-08-10T16:53:06Z

Bug Report

Ionic Info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 7.0.0 browser 5.0.3 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2 
    Node              : v10.6.0
    npm               : 6.1.0 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.4.1 Build version 9F2000 

Environment Variables:

    ANDROID_HOME : /Users/rattkin/Library/Android/sdk

Misc:

    backend : pro

Describe the Bug When using ion-datetime just to select and display time (HH:mm), it's not possible to get it to work correctly when using max attribute. While the picker correctly limits itself to just the hours specified (so, in the example below, no further than 15:15), the control itself remains invalid in Angular form, with error object { actualValue: NaN, requiredValue: NaN, max: true }.

Steps to Reproduce <ion-datetime displayFormat="HH:mm" pickerFormat="HH:mm" max="15:15" [(ngModel)]="arrivalTime" name="arrivalTime" #arrivalTime="ngModel" required></ion-datetime>

Expected Behavior The control should be valid if the time is less than max.

daraul commented 5 years ago

I've encountered an issue simliar to this when setting the max attribute on my ion-datetime in ionic 3.9. My angular form's field is always invalid, even though I can see and output it's value in the html (it's only requirement is that it be set).