Salesforce's date picker only allows you to select 1 date, but I want a date range picker. I found that the SLDS component blueprints seem to have static code for one here, but was wondering if Salesforce provides a date range picker as a web component, the way a single date picker is provided here.
Best Answer
The Datepicker range selector shown in the Lightning Design System Library is just the CSS part - the javascript logic for those blueprints are not fully implemented.
Currently the out of box components like
lightning-input type=date
does not support a range functionality as shown in the lightning design system documentation (although it might be in salesforce roadmap for future releases).This request has been an idea for quite some time.
Idea-exchange link: https://success.salesforce.com/ideaView?id=08730000000lCO6AAM
For now - there are 2 approaches
input type=date
field - Probably use a custom third party date picker which supports range functionality and uses the CSS from the SLDS library. This would require some effort.Or if you still want to make use of the out of box functionality (
lightning-input type=date
) - You could achieve a partial functionality for the range selection using thelightning-input type=date
.Here is a basic example of the second approach, you could implement or enhance something as follows.
One caveat that I observe with the second approach is that -
Output