Skip to content

bug: datetime, current minutes shown even if not included in minuteValue field #24722

Closed

Description

@mstichweh

Prerequisites

Ionic Framework Version

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

Current Behavior

When using the ion-datetime component for time selection with minuteValue set, eg. to [0,15,30,45] and without an initial value, the current time is preselected. But if the time is 10:20 for example, the preselected minute is "00". Pressing the "Done" button of the time selector without changing the minute, will set the value to "10:20" - the current time. This does not correspond to the displayed value of the selector. To set a time of "11:00", the user has to change the hour value and also the minute value to any different than "00" and back to "00".

Expected Behavior

If the user confirms the current selection, the current shown value of the selector should be provided by the time selector as new value. And not a minutes value which the user has never selected or even seen.

Steps to Reproduce

  • Setup an ion-datetime component for time selection only
  • Enable the default buttons to display the "Done" button
  • Set minuteValue, eg. to "0,15,30,45"
  • Provide no initial value
  • Open the time selector and confirm the selected time via the "Done" button
  • The provided time value is the current time but not "00" as minutes as selected

Code Reproduction URL

https://github.com/mstichweh/ion-datetime-minutevalues-bug.git

Ionic Info

Ionic:

Ionic CLI : 6.16.3 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.0.5
@angular-devkit/build-angular : 13.0.4
@angular-devkit/schematics : 13.0.4
@angular/cli : 13.0.4
@ionic/angular-toolkit : 5.0.3

Utility:

cordova-res : not installed globally
native-run (update available: 1.5.0) : 0.3.0

System:

NodeJS : v14.18.2 (/usr/local/bin/node)
npm : 7.24.2
OS : macOS Big Sur

Additional Information

No response

Activity

  1. changed the title [-]bug: [/-] [+]bug: Preselected minutes value not submitted by ion-datetime when initial value does not match an item of minuteValues[/+] on Feb 4, 2022
  2. changed the title [-]bug: Preselected minutes value not submitted by ion-datetime when initial value does not match an item of minuteValues[/-] [+]bug: ion-datetime not sets the correct minute value in some cases if minuteValues are provided[/+] on Feb 4, 2022
  3. self-assigned this
    on Feb 18, 2022
  4. sean-perkins commented on Feb 18, 2022

    @sean-perkins
    Contributor

    @mstichweh thanks for reporting this issue.

    I believe in instances where the developer passes minuteValue to filter the selection, we should likely ignore the current time and default to the lowest bounds of the minuteValue, in this case: 10:00.

    The user should definitely not be able to confirm a time value that is inconsistent with the filtered time selections.

    We will capture this as a bug and prioritize. Thanks!

  5. changed the title [-]bug: ion-datetime not sets the correct minute value in some cases if minuteValues are provided[/-] [+]bug: ion-datetime incorrect minute value when using minuteValue and current time[/+] on Feb 18, 2022
  6. removed their assignment
    on Feb 18, 2022
  7. changed the title [-]bug: ion-datetime incorrect minute value when using minuteValue and current time[/-] [+]bug: datetime, current time shown even if not included in minuteValue field[/+] on Aug 25, 2022
  8. changed the title [-]bug: datetime, current time shown even if not included in minuteValue field[/-] [+]bug: datetime, current minutes shown even if not included in minuteValue field[/+] on Aug 25, 2022
  9. liamdebeasi commented on Oct 11, 2022

    @liamdebeasi
    Contributor

    Thanks for the issue. Here is a dev build if you are interested in testing the proposed fix.

    npm install @ionic/angular@6.3.1-dev.11665512040.10240d49
    

    Please note that there is an existing bug where the wheel picker does not update the value property of datetime when using a default value. That is being tracked in #25839.

  10. liamdebeasi commented on Oct 26, 2022

    @liamdebeasi
    Contributor

    Thanks for the issue. This has been resolved via #26093, and a fix will be available in an upcoming release of Ionic Framework.

  11. added a commit that references this issue on Oct 26, 2022
    3745083
  12. ionitron-bot commented on Nov 25, 2022

    @ionitron-bot

    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.

  13. locked and limited conversation to collaborators on Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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