Q
Q
qwentry2021-02-05 13:04:57
JavaScript
qwentry, 2021-02-05 13:04:57

How to format input type date?

there is input type="date"

<div class="form-group">
              <input id="birthdayI" v-model="$v.customerIndividual.birthday.$model" type="date" placeholder="Дата рождения"
                     class="form-control form-control-lg main-text" >
              <p v-if="errors" class="error">
                <span v-if="!$v.customerIndividual.birthday.required">Это поле обязательно к заполнению</span>
              </p>
            </div>

$v.customer..... - used for validation with vuelidate.

On the input page of this field, the date type in input is DD-MM-YYYY, but in customerIndividual.birthday it is written as YYYY-DD-MM.
How can I format the date using momentjs so that customerIndividual.birthday is written as DD-MM-YYYY

:formatter="format"
format(value, event) {
    return moment(value).format('YYYY-MM-DD')
}

This option did not help or implemented it incorrectly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MamaLuyba, 2021-02-05
@MamaLuyba

Duc to be in the format "DD-MM-YYYY", and it is necessary to translate into this format: moment(value).format('DD-MM-YYYY')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question