ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.02k stars 13.51k forks source link

bug: HH:mm does not let you select hours #22199

Closed dibyendusaha closed 4 years ago

dibyendusaha commented 4 years ago

Bug Report

Ionic version: [x] 5.3.4

Current behavior: Using Ionic with Angular. issue with ion-datetime picker. When providing max & min (in HH:mm) for ion-datetime picker, it is behaving abruptly and that's too in between 13:00 & 00:30 (so far I have encountered that only), like you want to select 18:00 you get selection as 06:00, occurring mainly while selecting hours column and you need to select anything between 13:00 to 23:00, if you are selecting anything other than that, it will work fine

Expected behavior: Expected behavior is, the time I want to select should be the one only and there should not be any abrupt behavior.

Steps to reproduce: Create new ionic angular project with version 5.3.4

ionic start ionDateTimeBug blank --capacitor

Run the app

ionic serve

Related code:

Angular Page/View

<ion-content>

   <ion-item>
    <ion-label>Time</ion-label>
    <ion-datetime [hourValues]="hourValues " displayFormat="hh:mm A" pickerFormat="HH:mm" [min]="minTime" [max]="maxTime"></ion-datetime>
  </ion-item>  

</ion-content>

Associated Angular Component

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss'],
})
export class AppComponent {
  minTime = '06:30';
  maxTime = '23:30';
  hourValues = ['06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
  constructor() {}
}

StackBlitz (https://stackblitz.com) Ionic Angular StackBlitz: https://stackblitz.com/edit/ionic-v5-angular-iondatetime

Other information:

Ionic info:

Ionic:

   Ionic CLI                     : 6.11.7 (C:\Users\dibye\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.3.4
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 10.0.7
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.3.3

Capacitor:

   Capacitor CLI   : 2.0.0
   @capacitor/core : 2.0.1

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.16.2 (C:\Program Files\nodejs\node.exe)
   npm    : 6.14.4
   OS     : Windows 10
liamdebeasi commented 4 years ago

Thanks for the issue. I can reproduce this. This appears to be a regression in v5.3.3: https://codepen.io/liamdebeasi/pen/BaKEVra cc @brandyscarney

ionitron-bot[bot] commented 3 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.