In this post I describe how to fix/workaround the issue with DatePicker component in Sitecore SPEAK 2.
Usually, DatePicker works just fine but at some point we noticed that something wrong is happening with date selection …
I identified two issues:
- when we click the date in calendar it selects today rather than selected date
- when we click the date in calendar it shows that we selected the date but value is set for today’s date not one that is shown
It might be related to the fact that I had to DatePicker components on a single page. Also, it might be related to the custom format of data that we use in the DatePicker – dd/MM/yyyy.
/sitecore/shell/client/Business Component Library/version 2/Layouts/Renderings/Common/DatePickers/DatePicker.js
I fixed it by adding ‘global’ variable to store set value: “definedDate”
Then I use that variable in two places.
First one is formatDate function that is called usually after selection
Second one is inside getISODate where we use it to calculate correct date
That change solves the incorrect behavior of the form.