Skip to content

bug: ion-datetime does not clamp current date to min/max when switching months using month picker #27027

Closed

Description

@aparajita

Prerequisites

Ionic Framework Version

v6.x

Current Behavior

ion-datetime does not pin the date to the min/max when switching months with the month picker. If the day of the month is out of range when switching months, a warning is logged to the console and the current date is out of range.

Expected Behavior

The current date should be pinned to the min/max, as it is when using ion-datetime-button.

Steps to Reproduce

  1. Open the reproduction.
  2. Open the console.
  3. Select April 1.
  4. Open the month picker and switch to March. A warning is logged to the console and the current date is March 1, which is out of range.
  5. Select March 30.
  6. Open the month picker and switch to May. A warning is logged to the console and the current date is May 30, which is out of range.

Code Reproduction URL

https://stackblitz.com/edit/angular-7s6sah?file=src/components/Example.vue

Ionic Info

In Stackblitz:

Ionic:

Ionic CLI : 6.20.9

Utility:

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

System:

NodeJS : v16.14.2
npm : 7.17.0
OS : Linux 5.0

Additional Information

Since ion-datetime-button does pin the date to the min/max, it seems that ion-datetime should do the same when switching months.

Originally reported in #26904.

Activity

  1. averyrousseau commented on Mar 29, 2023

    @averyrousseau
    Contributor

    Thank you for the issue. I'm able to reproduce this behavior. Datetime has a clamping util that keeps certain dates within the min/max bounds; it looks like we just need to make sure that gets applied to this scenario too.

  2. changed the title [-]bug: ion-datetime does not pin current date to min/max when switching months[/-] [+]bug: ion-datetime does not clamp current date to min/max when switching months using month picker[/+] on Mar 29, 2023
  3. added
    package: core
    type: bug
    on Mar 29, 2023
  4. removed their assignment
    on Mar 29, 2023
  5. added a commit that references this issue on Apr 18, 2023
    0385c08
  6. averyrousseau commented on Apr 18, 2023

    @averyrousseau
    Contributor

    This has been resolved via #27185 and the fix will be available in a future release of Ionic. Thank you!

  7. added a commit that references this issue on Apr 19, 2023
    30e918c
  8. aparajita commented on Apr 19, 2023

    @aparajita
    Author

    Thank you!

  9. ionitron-bot commented on May 19, 2023

    @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.

  10. locked and limited conversation to collaborators on May 19, 2023
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

    package: coretype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions