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

DateInput Date Time mode does not register the time #308

Closed
LaiaBigFish opened this issue Sep 9, 2024 · 2 comments · Fixed by #314
Closed

DateInput Date Time mode does not register the time #308

LaiaBigFish opened this issue Sep 9, 2024 · 2 comments · Fixed by #314

Comments

@LaiaBigFish
Copy link

LaiaBigFish commented Sep 9, 2024

The component returns only the date. Can replicate issue on website/using website example

from datetime import datetime

import dash_mantine_components as dmc
from dash import Output, callback, Input, html

html.Div(
    [
        dmc.DateInput(
            id="datetime-time",
            valueFormat="DD/MM/YYYY HH:mm:ss",
            label="Date and Time input",
            value=datetime.now(),
            w=250,
        ),
        dmc.Space(h=10),
        dmc.Text(id="selected-datetime"),
    ]
)


@callback(Output("selected-datetime", "children"), Input("datetime-time", "value"))
def update_output(d):
    prefix = "You entered: "
    if d:
        return prefix + d
    else:
        return ""

@AnnMarieW
Copy link
Collaborator

Thanks for reporting @LaiaBigFish

It looks like this feature is not available yet in dmc, and I'll remove it from the docs until it's ready to go.
In the meantime, would the dmc.DateTimePicker work for you? It's available, just not documented yet

https://mantine.dev/dates/date-time-picker/

import dash_mantine_components as dmc
from dash import Dash, _dash_renderer
_dash_renderer._set_react_version("18.2.0")

app = Dash(external_stylesheets=dmc.styles.ALL)

app.layout = dmc.MantineProvider(
    dmc.DateTimePicker(
        label="Pick date and time",
        placeholder="Pick date and time",
    )
)

if __name__ == "__main__":
    app.run(debug=True)

@LaiaBigFish
Copy link
Author

Yes, that is perfect, thank you! I did not know it was available :)

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

Successfully merging a pull request may close this issue.

2 participants