Sitecore 9.0.1 Datepicker displaying wrong format

Hi Everyone !During this week I was playing Sitecore Datetime and found something weird.

The Sitecore “Select Date” pop-up was showing an incorrect format of the field

The Sitecore installation was on USA, without any datetime customization, so, everything out of the box

On Sitecore Content Editor the format was displaying correct, as the image below

Content Editor DateTime

So far so good, the issue was detected when the user clicked on the Calendar icon and the “Select Date Window opened”

PublishedDate

As we can see, the format is “dd/mm/yyyy” but everything on the system points to “mm/dd/yyyy”

wrong date time picker

I tested on my machine and on a server, and I saw the error in two places, Locally it would be perhaps ok to show this, because this is the Brazilian date format, but on the US server it was something wrong .

So I found some articles to force like this one to force Sitecore to a DateTime (https://blog.ryanbailey.co.nz/2016/05/incorrect-date-format-in-content-editor.html) and it failed !.

But after digging the component and some more research I found this bug on Sitecore 7.1 (https://www.redmoon.london/sitecore-71-speak-datepicker-component-cant-set-date-format/)

The Solution pointed on this blog, was to change the format, so that is what  I performed and tested.  setting manually it worked of course, BUT , So far i could not find an elegant solution, and the only thing that solves was editing the (sitecore\shell\client\Business Component Library\Layouts\Renderings\Common\DatePickers\DatePicker.js) file

this.model.set(“dateFormat”, “mm/dd/yyyy”); (check the new version below)

I also created a Ticket on StackOverflow to see if something has a better solution for this

https://sitecore.stackexchange.com/questions/11553/sitecore-9-1-datepicker-displaying-wrong-format

Let’s see if we can find a better solution for this issue!

UPDATE–

OCTOBER 13, 2018  I got an answer from Slack to my Question

Sitecore provided a solution for Rodrigo Peplau he posted the offical Sitecore fix for this issue , the code is similar, but with a small change

this.model.set(“dateFormat”, this.$el.attr(“data-dateformat”));