I am migrating from Drupal 7 to Drupal 8. In forms I use '#type' => 'date_popup' for date fields, which Drupal 8 replaces by '#type' => 'date' and uses HTML 5.

I'm finding it most unsatisfactory because:

  1. It has poor browser support; Internet Explorer 11 doesn't provide a popup.
  2. I can't find anyway to change the input format from 'm/d/yyyy' to either 'd/m/yyyy' or 'yyyy-mm-dd'.

I have ensured that my browser language setting is English (Australian) which has a default date format of 'd/m/yyyy'.

Does anyone have a solution that provides a date picker for most the browsers and a text input format that can be controlled by the server, not the client?

1 Answer 1


I had a similar issue just recently within a client's intranet application, after Firefox added HTML5 date field support. (FF is their corporate browser of choice.)

You can still use any JavaScript based datepicker that suits your needs. (E.g. jQuery UI's datepicker.)

In your JavaScript bind this datepicker to all input fields of type date and then change the type of the input fields to text. This prevents the browsers from using their own datepickers.

PS.: It's not exactly a Drupal specific question, but tomorrow when back in my office I might add a code example that works for Drupal 8.

  • Thats the solution that I have decided to use and have it working with Drupal 8. I was hoping there might be a native Drupal solution, rather than having to reinvent the wheel.
    – ajp99
    Commented Dec 12, 2017 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.