How to format the date to the Brazilian standard in an attribute of type "DATEONLY" using sequelize?

Asked

Viewed 29 times

-1

I own a model with a date attribute of type DATEONLY, when I step into the body of the request 01/02/1999, and the return is "date": "1999-01-02". How can I format for the Brazilian standard?

    date:{
    type: DataTypes.DATEONLY,
    allowNull: false
    
},

1 answer

-2

A good way for you to do this for data formatting is to use Moment.js. Examples in https://momentjs.com/;

date = Moment(date). format("DD/MM/YYYY") as any;

  • Moment.js was discontinued the manufacturer warns that the library should not be used in new projects.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.