Date format configuration in VueJS / Quasar Framework

1

I have a field for entering the date of birth, and I want the result of the insert to be formatted in 'DD-MM-YYYY'. I was able to make the date appear in the input in the desired formatting, however when I send the date to the database it goes like this: "1997-08-19T00: 00: 00.000-03: 00".

I created a function to format the date, but it did not work:

formatarData () {
    let data = this.pessoa.nascimento
    this.pessoa.nascimento = date.formatDate(data, 'DD-MM-YYYY')
  }

Now you are going to the bank like this: "NaN-NaN-0NaN", how to format so that it goes out as desired ??

    
asked by anonymous 16.08.2017 / 15:14

1 answer

2

For those who need help, I was able to solve it as follows:

formatarData () {
    let data = this.pessoa.nascimento
    this.pessoa.nascimento = moment(data).format('DD/MM/YYYY')
  }

I used MomentJS to convert the date format. this.pessoa.nascimento refers to the object that I'm converting to the date of birth.

I hope this clarification will be useful to more people just as it was for me.

    
16.08.2017 / 16:00