Skip to content

Conversation

@KoolADE85
Copy link
Contributor

@KoolADE85 KoolADE85 commented Nov 7, 2025

At long last, here is a PR to modernize the date pickers.

You can play with them here:
https://dcc-redesign.plotly.app/datepickers-single
https://dcc-redesign.plotly.app/datepickers-range

Some improvements:

  • Consistent with dcc.Dropdown's look and feel
  • Keyboard accessible with focus carefully managed
  • Support for mouse drag & wheel (and click of course)
  • DatePickerRange supports selecting backwards as well as forwards
  • A range of tests added for both new and existing features.

Closes #3391

@KoolADE85 KoolADE85 force-pushed the feature/dcc-refactor-datepicker branch 2 times, most recently from b2d62da to de88f2b Compare November 7, 2025 17:48
@KoolADE85 KoolADE85 force-pushed the feature/dcc-refactor-datepicker branch from de88f2b to 75fd1fe Compare November 7, 2025 19:11
@AnnMarieW
Copy link
Collaborator

Wow! First look at this is amazing 🤩

I love how you can easily skip months and years - that's been a pain point in the old date pickers for a long time.

This is an incredible amount of work given that the Radix components does not have date pickers and you had to build all of this from scratch.

I see you are still using moment.js for the date formatting. Since they are no longer recommending moment.js to be used in new project, would you consider using one of their recommended alternatives? It might make it easier to add support for locale at some point https://momentjs.com/docs/#/-project-status/

@KoolADE85
Copy link
Contributor Author

Thanks @AnnMarieW ! And wow, I did not realize moment was fading away like that! I will take a look at replacing moment - it shouldn't be too much effort there.

Wow! First look at this is amazing 🤩

I love how you can easily skip months and years - that's been a pain point in the old date pickers for a long time.

This is an incredible amount of work given that the Radix components does not have date pickers and you had to build all of this from scratch.

I see you are still using moment.js for the date formatting. Since they are no longer recommending moment.js to be used in new project, would you consider using one of their recommended alternatives? It might make it easier to add support for locale at some point https://momentjs.com/docs/#/-project-status/

Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Comment on lines +9 to +10
* DatePickerRange is a tailor made component designed for selecting
* timespan across multiple days off of a calendar.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove the tailor made from the description.

Comment on lines +1 to +22
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import * as Popover from '@radix-ui/react-popover';
import {
CalendarIcon,
CaretDownIcon,
Cross1Icon,
ArrowLeftIcon,
ArrowRightIcon,
} from '@radix-ui/react-icons';
import AutosizeInput from 'react-input-autosize';
import Calendar, {CalendarHandle} from '../utils/calendar/Calendar';
import {DatePickerRangeProps, CalendarDirection} from '../types';
import {
dateAsStr,
strAsDate,
formatDate,
isDateDisabled,
isSameDay,
} from '../utils/calendar/helpers';
import '../components/css/datepickers.css';
import uuid from 'uniqid';
import moment from 'moment';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These imports should be grouped/sorted, third parties first then local file.

@T4rk1n
Copy link
Contributor

T4rk1n commented Nov 14, 2025

I see you are still using moment.js for the date formatting. Since they are no longer recommending moment.js

I would also recommend we change to something else, I don't think we use that much moment.js. Luxon seems like a good alternative, I also had a good experience with date-fns before.

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 this pull request may close these issues.

4 participants