Is there a simple way to make Sequelize return it's date/time fields in a particular format?

后端 未结 4 1279
攒了一身酷
攒了一身酷 2020-12-16 00:44

We need to have sequelize return dates in a particular format, not the default one. As far as I can tell, there is no way to set that up in options, or any other way. Short

4条回答
  •  天涯浪人
    2020-12-16 01:23

    you can define custom instance methods getDate/setDate which would translate date between sequelize internal representation and desired format like so http://sequelize.readthedocs.org/en/latest/docs/models-definition/index.html (see 'Expansion of models' section)

提交回复
热议问题