0

Our requirement is to set the date input field format to mm/dd/YYYY

As far as I know, the format is controlled by users' OS environment.

For example, if a user from China the format might by dd/mm/YYYY

If I'm from US the format might be mm/dd/YYYY

Is it possible to enforce the format at mm/dd/YYYY no matter the user's locale settings?

inline

    <!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date -->

    <form>
      <div>
        <label for="bday"> Enter your birthday:</label>
        <input type="date" id="bday" name="bday" required >
        <span class="validity"></span>
      </div>
      <div>
        <input type="submit">
      </div>
    </form>
newBike
  • 14,385
  • 29
  • 109
  • 192
  • Why do you want that? You can get the native `Date` as value. Also, keep in mind that input `type="date"` is [not supported](https://caniuse.com/#feat=input-datetime) in all browsers. – Marko Gresak Mar 15 '18 at 22:51
  • Possible duplicate of [Is there any way to change input type="date" format?](https://stackoverflow.com/questions/7372038/is-there-any-way-to-change-input-type-date-format) – Andrew Myers Mar 15 '18 at 23:55
  • @MarkoGrešak I need to configure the presentation date format. – newBike Mar 16 '18 at 02:26

0 Answers0