Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Is there a way to skip by year on date-picker?

I have a dash app where I have a date-picker with start date and end date:

dcc.DatePickerRange(
            id='date-picker-range',
            start_date_placeholder_text='Starting date',
            end_date_placeholder_text='Ending date',
            min_date_allowed=datetime.datetime.now() - datetime.timedelta(days=10*365),
            max_date_allowed=datetime.datetime.now(),
            initial_visible_month=datetime.datetime(2009, 1, 1),
            end_date=datetime.datetime.now()
        ),

The difference between the start and end dates can be upto 10 years. So, its not convenient to skip by month as it would be tedious to do it hundreds of times to go to a very old date. Is there a way to skip by year instead of month?

Also, somewhat related, is there a way to set different initial_visible_month for the start and end dates? For example, the initial_visible_month could be somewhere in 2010 for the start date and in 2018 for the end date.

I don’t think that is supported right now but you can use RangeSlider in Dash if you only want to select year range.

Also, just want to mention that you are not considering leap year with datetime.timedelta(days=10*365).

def add_year(date):
    if is_leap_year(date.year):
        delta = datetime.timedelta(days=366)
    else:
        delta = datetime.timedelta(days=365)

    return date + delta

thats cool idea man yes also want to know hope is there anyone who can help me out too.
with regards
miles smith
https://notepad.software/ https://vidmate.onl/download/

I would also like to have a a DatePicker Single or Range that allows you to jump by year, not just day/month.

As far as I know this is not supported yet, so in order to achieve it I agree with @caiyij RangeSlider is the best option as of now!

Regards, 9Apps Cartoon HD

The difference between the start and end dates can be upto 10 years. So, its not convenient to skip by month as it would be tedious to do it hundreds of times to go to a very old date. Is there a way to skip by year instead of month?

Same issue
Regards,
mxplayer

i need to skip certain months with jQuery datepicker on months selection while using the “prev” and “next” buttons.

This works well when triggering the “next month” button of the datepicker and remapping months when reaching an unwanted month that is not available for selection, but the “previous month” button gives me unusual behaviour and i don’t know why

for all of you who are in need of a similar solution here is my approach. I am not happy with it, as it is very static and the eventhandling is a little cheated (due to wrong event stack ordering in my project), but it does the trick. jiofi login https://forpc.onl

datepicker ({ minDate: dateToday, maxDate: ‘+’ . $maxDate . ‘m’, changeYear: true, changeMonth: false, beforeShowDay: available , yearRange: "’ . … live(“click”, function() { if(month == 6){ year = jQuery(‘select[class=ui- datepicker - year ]’).

i think to have a a DatePicker Single or Range that allows you to jump by year. .