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

[BUG] - Input with "datetime-local" type has wrong margin when setting min/max date #3026

Open
JobberRT opened this issue May 20, 2024 · 9 comments

Comments

@JobberRT
Copy link

NextUI Version

2.3.6

Describe the bug

The Input component will have a wrong padding/margin when using datetime-local with min/max and some of the field are disabled.

Bug screenshot

image

Normal screenshot

image

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Create a Input component and set its max to now(so that some fields can be disabled, like year).

Expected behavior

The margin/padding is correct

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

@wingkwong
Copy link
Member

Can you share the code you used for the screenshot?

@JobberRT
Copy link
Author

@wingkwong

const [tt, setTT] = useState("2024-05-20T12:00:00");

<div className={"flex flex-row flex-wrap items-center justify-between gap-3 sm:gap-5 md:gap-10 lg:gap-16"}>
    <div className={"flex flex-grow"}>
        <div className={"flex items-center justify-center gap-0.5"}>
            <Input type={"datetime-local"} value={tt} onValueChange={setTT} 
                   max={new Date(Date.now()).toISOString().slice(0, -5)} 
                   min={new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString().slice(0, -5)} />
        </div>
    </div>
</div>

@wingkwong
Copy link
Member

@JobberRT I still don't know how to reproduce the issue based on this code. Can you elaborate more?

image

@JobberRT
Copy link
Author

@wingkwong Maybe because you are using PM/AM while I'm using 24H ? In my environment, the exact same code can reproduce the bug though.

I also tried remove the "second" part of the time string, the bug is still there

@wingkwong
Copy link
Member

Can you share a stackblitz project so that we could be on the same ground?

@JobberRT
Copy link
Author

Sure, Here's the link: https://stackblitz.com/edit/vitejs-vite-x36zme?file=src%2FApp.tsx

@wingkwong
Copy link
Member

wondering if you see the same screen

image

@JobberRT
Copy link
Author

Seems not... I got not PM/AM choice, it's 24H. May this be the issue?
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants