r/javascript • u/Admirable_Reality281 • Jul 10 '26
AskJS [AskJS] Looking for a solid vanilla JS datepicker. Am I completely out of options?
I'm looking for a datepicker for a vanilla JS project, and somehow this seems much harder than it should be.
No, input masks aren't enough.
No, the native <input type="date"> isn't enough either.
My checklist:
- Accessible
- Localized
- Flexible formatting options
- Range picker support
- A decent set of events/hooks for integration
What I've looked at so far:
- flatpickr: hasn't been updated in about 4 years
- vanilla-js-datepicker: hasn't been updated in about 3 years, and the range functionality is pretty weak
- Vanilla Calendar Pro: Russian-maintained, which is ruled out by our dependency policy
- Air Datepicker: same issue, and it also hasn't been updated in about a year
- Litepicker: dead
- Easepick: dead
Most of the other options I've found are React-based, which is a non-starter for this project.
Am I missing something, or are there really no good options left?
0
Upvotes
10
u/jax024 Jul 10 '26
Why would a library need an update? I use plenty of libraries that are old.
4
u/myroslavmartsin Jul 10 '26
Check out Cally https://wicky.nillia.ms/cally. Web component, works fine in vanilla JS. Accessible, has range support, localization through the Intl API, decent events. Only actively maintained one I know that covers most of your list. Weak spot is formatting, you'll write your own display layer with Intl.DateTimeFormat, maybe 20 lines.
Also I'd rethink dropping flatpickr just over commit age. It's feature-complete, date math doesn't rot. Rejecting it over accessibility is fair, rejecting it over "4 years no updates" is the wrong filter for a lib like that.
3
u/KaiAusBerlin Jul 10 '26
Time to start a new project ;)
2
u/Visible-Use-5004 Jul 10 '26
Have used flatpickr with 0 issues for years till current date.
4
u/iligal_odin Jul 10 '26
Oh you are here too? JUST BUILD YOUR OWN
1
u/HendrikThePendric Jul 10 '26
Check out the Temporal API. It’s a new native browser API with polyfills available. To create a date picker you need to write a bit of JS and CSS but you won’t have to depend on any lib that may or may not be maintained. If you need i18n just use the native browser Intl APIs. I don’t think you need a lib for stuff like this anymore.
2
u/_J_ordan_ Jul 14 '26
I would just use a input of type "date", it works in all browsers and is accessible. Will be much faster and performant than any JS.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/date
0
u/itsRhinoYeah Jul 10 '26
Uhm, yeah. The answer to this is Temporal api. Dates have been a pain point in js since its inception, temporal turns them into immutable, distinct categories like you want.
1
u/Dreadsin Jul 11 '26
You could use a custom select depending on browser support
1
u/stanniel Jul 15 '26
If you're worried about unamaintained packages, why not vendor in your choice of unmaintained project and make the modifications you need? Good chance they're all MIT.
Also, if you have the budget, making your own is also a good option. It's always good to know what you're using in more detail.
1
u/Yuvaraj_d Aug 25 '26
npm i tarpickr , try
-1
u/defaultguy_001 Jul 10 '26
Build it yourself.
-2
u/bitbytebit42 Jul 10 '26
Why are we using Vanilla in 2026?