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

DateTime returns off-by-one date #9573

Closed
1 task done
mahdafr opened this issue Oct 7, 2024 · 4 comments · Fixed by #9825
Closed
1 task done

DateTime returns off-by-one date #9573

mahdafr opened this issue Oct 7, 2024 · 4 comments · Fixed by #9825
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mahdafr
Copy link

mahdafr commented Oct 7, 2024

Describe the bug

When I use the gr.DateTime as an input field, and select a date, the field fills with the previous date (off-by-one). It also reports to the callback function the off-by-one date. Video shows example of bug.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

def tmp(date):
    return "The date is {0}".format(date)

demo = gr.Interface(
    fn=tmp,
    inputs=[gr.DateTime(label="Date", include_time=False, type="datetime")],
    outputs=[gr.Textbox(label="Output")],
)

demo.launch()

Screenshot

test.mp4

Logs

$ python3 test.py
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
^CKeyboard interruption in main thread... closing server.

System Info

$ gradio environment
Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.44.1
gradio_client version: 1.3.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.6.0
fastapi: 0.115.0
ffmpy: 0.4.0
gradio-client==1.3.0 is not installed.
httpx: 0.27.2
huggingface-hub: 0.25.1
importlib-resources: 6.4.5
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.9.2
numpy: 2.1.1
orjson: 3.10.7
packaging: 24.1
pandas: 2.2.3
pillow: 10.4.0
pydantic: 2.9.2
pydub: 0.25.1
python-multipart: 0.0.12
pyyaml: 5.4.1
ruff: 0.6.8
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.12.2
urllib3: 2.2.3
uvicorn: 0.31.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.9.0
httpx: 0.27.2
huggingface-hub: 0.25.1
packaging: 24.1
typing-extensions: 4.12.2
websockets: 12.0

Severity

Blocking usage of gradio

@mahdafr mahdafr added the bug Something isn't working label Oct 7, 2024
@rabelmervin
Copy link

Hi madam @mahdafr, I'm interested to solve this issue... Could you please tell the location of the code ?

@mahdafr
Copy link
Author

mahdafr commented Oct 18, 2024

I'm not sure what you mean - the Reproduction has all the code I have used to run into the bug. Is that what you meant?

@mahdafr
Copy link
Author

mahdafr commented Oct 24, 2024

Woah, that's an interesting bug! Can't wait for the release 🥳

Thanks!

@tseronni
Copy link

tseronni commented Jan 3, 2025

I'm having the same problem. Still not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants