Giter Club home page Giter Club logo

Comments (5)

snehilvj avatar snehilvj commented on May 28, 2024

Hi @bigmike36c, Thanks for reporting this issue. I agree with your comment about the behaviour and I have corrected that (will be released in 0.6.0).
Regarding your second issue, can you please briefly explain your process? How will you use it if single date selection were to trigger a callback.

from dash-mantine-components.

bigmike36c avatar bigmike36c commented on May 28, 2024

Thanks for correcting this so quickly!

In my mind, if a user only selects a single date, then the user expects the date range to extend from the start date to the maximum date available.

The code snippet below is essentially how I've been handling this with the default dcc.DatePickerRange. If the callback is triggered with only one date selected (either start or end), the other date is simply set to an empty string in the callback. I then convert the empty string to the minimum or maximum date in the dataframe.

start_date = start_date or df["datetime"].min()
end_date = end_date or df["datetime"].max()

Since the dmc.DateRangePicker only lets you select the start date on its own, I think it would make the most sense for the callback to receive ["selected_start_date", maxDate]. If the maxDate parameter was not set, it could be replaced with an empty string or None.

from dash-mantine-components.

snehilvj avatar snehilvj commented on May 28, 2024

Okay got it.
I can think about partial callback where in you at least get one date which is selected (keeping in mind backwards compatibility).
But I don't think we can do

callback to receive ["selected_start_date", maxDate].

It makes the date range picker less intuitive as to what's in the value is not what's displayed, etc.

from dash-mantine-components.

bigmike36c avatar bigmike36c commented on May 28, 2024

Makes sense to me. Could the callback just trigger with "selected_date" as a string instead of a list? This would make it easy to handle both single date and range selections in the callback logic with the isinstance() function.

from dash-mantine-components.

snehilvj avatar snehilvj commented on May 28, 2024

Ability to select single date won't be supported in dmc.DateRangePicker, for such purposes please use two date pickers.

from dash-mantine-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.