Skip to content

Timepicker time resets when using AM/PM toggle  #29720

Closed

Description

@tomjn

Description

The AM/PM selectors are non-functional, the hour box gets reset to the previous value when switching from AM to PM

Originally reported in a related issue by @Ipstenu, who added a GIF of the problem:

I bet this is related -- if you click on the time and change it, it defaults to AM every time. I'm attaching a GIF of this:

am-pm-who-knows

Related issue #24206

Step-by-step reproduction instructions

Expected behaviour

Setting 11am then pressing PM would change it to 11PM

Actual behaviour

The time is briefly set to 11PM but changes back to 11AM by itself after a brief moment.

Of note, the underlying date/time value does get changed correctly, and can be seen if the value is used in an unrelated component. However, when it is reset in the timepicker component, all other components using this value change too, so it isn't purely local state of the timepicker component that's being reset.

WordPress information

  • WordPress version: 5.6.1, 5.7
  • Gutenberg version: stock WP and GB 10
  • Are all plugins except Gutenberg deactivated? yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? No

Device information

  • Device: MBP 13" Intel, MacOS Big Sur
  • Operating system: MacOS
  • Browser: Chrome 88

Activity

  1. tomjn commented on Mar 10, 2021

    @tomjn
    ContributorAuthor

    Some notes from a brief look that I left in the other issue:

    Do we want to move the AM/PM bug to a new ticket?

    I spent 10 minutes to do a quick look these are the next avenues of investigation I would take:

  2. added
    [Feature] UI Components
    [Type] Bug
    on Mar 31, 2021
  3. bmehta commented on Nov 17, 2021

    @bmehta

    We are seeing the exact same behavior as shown in the giphy above. It is also reproducible at https://wordpress.github.io/gutenberg/?path=/story/components-datetimepicker--default after navigating to Knobs at the bottom and checking Is 12 hour (shows AM/PM).

  4. ciampo commented on Nov 25, 2021

    @ciampo
    Contributor

    Opened #36878 with a potential fix

  5. added
    [Status] In Progress
    on Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] UI Components[Status] In Progress[Type] Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions