Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pickers] AM/PM field is not disabled when validation fails for the minTime and maxTime properties. #15410

Closed
A-s-h-o-k opened this issue Nov 14, 2024 · 2 comments
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@A-s-h-o-k
Copy link

A-s-h-o-k commented Nov 14, 2024

Steps to reproduce

Steps:

import * as React from 'react';
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
import dayjs from 'dayjs'

export default function BasicTimePicker() {
  return (
    <LocalizationProvider dateAdapter={AdapterDayjs}>
      <DemoContainer components={['TimePicker']}>
        <TimePicker label="Basic time picker" minTime={dayjs().add(8, 'h')}/>
      </DemoContainer>
    </LocalizationProvider>
  );
}
snip timpicker issue

Current behavior

When the AM/PM (12-hour format) option is selected in the time picker, the AM/PM field is not disabled, even if the minTime is set to a later time. This allows users to select 'AM,' even if that time has already passed, while the other fields are working properly.

Expected behavior

When the AM/PM (12-hour format) is selected in the time picker, the AM/PM field should be disabled.

Context

this issue occurs when you pass the ampm prop true to the timepicker

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: timepicker

@A-s-h-o-k A-s-h-o-k added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 14, 2024
@michelengelen michelengelen added component: pickers This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 14, 2024
@michelengelen michelengelen changed the title The AM/PM field is not disabled when validation fails for the minTime and maxTime properties. [pickers] AM/PM field is not disabled when validation fails for the minTime and maxTime properties. Nov 14, 2024
@michelengelen
Copy link
Member

Thanks for opening an issue for this @A-s-h-o-k ... I could not find a quick solution for this so I will add it to the board for the team to estimate. 👍🏼

@michelengelen michelengelen removed the status: waiting for author Issue with insufficient information label Nov 14, 2024
@LukasTy
Copy link
Member

LukasTy commented Nov 15, 2024

This issue looks like an already estimated duplicate of #12159.
Closing this one as duplicate in favor of the mentioned issue. 😉

@LukasTy LukasTy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
@LukasTy LukasTy added the duplicate This issue or pull request already exists label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants