In Datepicker control of salesforce, most of the developers must have faced issue on year range for Datepicker control. We cannot configure the year range in standard date picker control. However, for a long time i am using a JQuery code to change the range of years in Datepicker and thought to share with you. You can find similar solution at many places but thought to add in my articles library also.
Navigate to “Set up | App SetUp | Customize | Home | Home Page Components”.
click on “New” Custom Component. In Next screen you will prompted with the type of Homepage component.
Select “HTML Area”.
In Next screen, click on checkbox “Show HTML” as shown in below image.
- While importing JQuery from Google or any other CDN, don’t write “http” protocol. It will automatically detect the protocol.
- If you are using Datepicker in custom Visualforce page and if sidebar is not enabled then above work around will not work.
- We are hiding the home page component itself by line “parent().parent().hide()”, as there is no need to show this component to end user.
Update – 23-Jul-2015