2
votes

Im using Bootstrap-Vue component and looking for a way to customise the input date field to mm/dd/yyyy format. Any proper ways ?

<b-input-group class="mb-3">
        <b-form-input
          id="example-input"
          v-model="dateOfBirth"
          type="text"
          placeholder="MM-DD-YYYY"
          locale="en-US"
          autocomplete="off"
        ></b-form-input>
        <b-input-group-append>
          <b-form-datepicker
            v-model="dateOfBirth"
            button-only
            right
            locale="en-US"
            :date-format-options="{ year: 'numeric', month: 'short', day: '2-digit', weekday: 'short' }"
            aria-controls="example-input"
          ></b-form-datepicker>
        </b-input-group-append>
      </b-input-group>

Documentation https://bootstrap-vue.org/docs/components/form-datepicker

1

1 Answers

0
votes

Does setting each component as numeric not achieve the right format?

<b-form-datepicker
  :date-format-options="{ year: 'numeric', month: 'numeric', day: 'numeric' }"
  locale="en"
></b-form-datepicker>

Gives: 9/16/2020