Skip to content

bug: ion-datetime timepicker does not respect hour cycle format with min provided #24474

@jongbonga

Description

@jongbonga

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

When setting the minimum DateTime to now (new Date()), there is no way to select previous minutes even on a different hour.
And the hour wheel doesn't respect the default h23 even when specified.

Expected Behavior

  1. The min value should restrict only up to what is specified. if minimum was set to 19:30, I should be able to select 20:everthing else
  2. The hour should stick to the default hour system or the specified one

Steps to Reproduce

RPReplay_Final1640193110.2.mp4
  now = moment().add(1, 'h').format();
  minInsterval: number[];
  dateTime:any

ngOnInit() {
    const min = 0,
      max = 55,
      interval = 5;

    const length = (max - min) / interval + 1;
    this.minInsterval = Array.from({ length }, (_, i) => min + i * interval);
  }
<ion-datetime
        #calendar
        size="cover"
        hourCycle="h23"
        [min]="now"
        [minuteValues]="minInsterval"
        [(ngModel)]="dateTime"
      >
      </ion-datetime>

Code Reproduction URL

No response

Ionic Info

Ionic:

   Ionic CLI                     : 6.18.1 (/Users/jonathan/.nvm/versions/node/v16.13.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.0.1
   @angular-devkit/build-angular : 13.1.2
   @angular-devkit/schematics    : 13.1.2
   @angular/cli                  : 13.1.2
   @ionic/angular-toolkit        : 5.0.3

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions