1
I have a field for inserting the date of birth, and I want the insertion result to be formatted in 'DD-MM-YYYY'. I managed to have the date displayed in the desired format input, but 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 didn’t work very well:
formatarData () {
let data = this.pessoa.nascimento
this.pessoa.nascimento = date.formatDate(data, 'DD-MM-YYYY')
}
Now it is going to the bank like this: "Nan-Nan-0NaN", how to format so that it exits in the desired form??
That one "field for insertion" is it text or is it a calendar with dates to click? What is
date
in that second line?– Sergio
It’s a Datetime, a calendar to click and choose dates, but I’ve already solved it using Moment.JS. And the date is a Vue import
– LeonardoEbert
Have you solved the question or the date input part? (and what is
date
that you have heredate.formatDate(
?)– Sergio
I managed to solve the question as a whole. The
date
is a Vue resource, which can be used through aimport
, but I couldn’t do what I wanted using it, so I used Moment.JS, which worked perfectly.– LeonardoEbert
Okay, so you can delete the question or give an answer. If you answer, you need to clarify the question further, because you still can’t tell from the outside.
– Sergio
Okay, I’ll answer her, so I can help someone who might need it in the future, feel free to edit it if you feel it’s necessary... Thank you for your attention
– LeonardoEbert