Finding a good datepicker for your application should be easy, but there are so many options out there and many things to take into consideration.
Understanding what to look for and what features you can envision needing for your project will be very helpful and a good thing to think about up front when choosing your datepicker.
Before making a final decision on a particular datepicker component (or library), you should use the React Performance Tools to analyze the performance and try to replicate a real use case or scenario that is similar to how you will use it in production.
The React.js Blog's Introducing the React Profiler is a good tool for measuring React component performance in the browser. Just as you would profile components you build and release yourself, when looking for a component to bring into your project you should always be testing them within your own application.
All React component libraries should give you the ability to install through npm or GitHub. It should be simple to find the packages, install them into your project and get to work.
The following list of features is largely based on my experience building line of business applications and different scenarios where I have required a datepicker.
We have all seen the date pickers on webpages that use three different native browser dropdowns for month date and year. This is not a clean user experience and there are several reasons why you most likely don't want to do this in your application. The first is that it is much harder to swap the order of dropdowns than it is to simply supply the datepicker with a different date format. Second is that you leave the developer having to put these separate values together after the selection in order to get the full date that we really need to work with.
Another reason is that it is much harder to ensure that the user actually selects each dropdown correctly and it creates a less scalable overall solution that does not fare well with users. Dropdowns as datepickers also provide the worst user experience for users on mobile. My recommendation is to stay away from this method of selecting a date. This is where the almighty datepicker comes into play!
Selecting a React datepicker that offers localization provides a better user experience. A lot of datepickers give you the option to have just an input which has a masked date, usually having what looks like placeholder text that indicates the month or day, followed by the year. With this setup, you will usually be able to format the date very easily. This gives us the ability as developers to determine the format as well as set it by locality. In the US, I will want the month first, but in the UK, I will want the day first.
The input is great for those who mostly use their keyboards when filling out forms, but this is not every user - others rely on the mouse or finger to select from a calendar. This is why I think your datepicker should feature both of these options, and most datepickers I run across on forms do supply both options.
A datepicker should provide a good user experience, solid keyboard controls, strong mobile functionality, and the ability to work with gestures. Ask yourself if the component you’ve picked can do all of these things or at least the ones necessitated by your application.
Every application is different. When booking flights, we typically need the date range feature, but having a button for today's date or the ability to select time is not as important. However, when visiting your dentist's website or choosing a doctor visit or maybe the best time to take your car in to get serviced, these scenarios may need a single datepicker with the option of selecting time. Another tricky situation is a birthday datepicker. In my opinion, the best way to do this is with a three-step process. Select the Month, then day and finally the year of the date you are trying to input. Because different applications throw different scenarios at you, the best datepickers will be ones that provide a variety of different options for the developer out of the box.
To put it simply, components that are not licensed rarely have any type of support outside of at-will community help. Everyone from big web development shops and enterprise level businesses to one-person consulting shops often have tight deadlines and their developers push technology to the edge. With a paid license, you have the added support of access to a team that has expert knowledge of the components you're working with.
I’ve shared with you my key criteria on which to evaluate a React datepicker for your next application – performance, package support, clean UX, input options, keyboard control and enterprise-level support. If there are any features that you think you can't live without, put them in the comments and let us know what your favorites are.
My goal here is not to push you in the direction of a single datepicker, instead, I would rather give you some of my ideas of what the best datepicker is and let you decide which one to choose. That said, if the KendoReact DatePicker is on your list to evaluate, my friend Carl has put together a great piece called "Unleash the Power of the KendoReact Datepicker Component." It is a great resource to learn how to leverage this particular React DatePicker’s power and build something amazing. Reading it might save you some time during the evaluation process.
At the end of the day, I always recommend you do your due diligence and research the datepicker that works best for you.
Eric Bishard is a Developer Advocate and former member of the KendoReact team at Progress. A software engineer with experience building web based applications with a focus on components for user interfaces in Angular and React, Eric works with @Couchbase, tweets @httpJunkie and blogs at ReactStateofMind.com.
Subscribe to be the first to get our expert-written articles and tutorials for developers!