Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我的项目框架取出来的时间会少8小时 #75

Open
expzhizhuo opened this issue Apr 27, 2022 · 0 comments
Open

我的项目框架取出来的时间会少8小时 #75

expzhizhuo opened this issue Apr 27, 2022 · 0 comments
Labels

Comments

@expzhizhuo
Copy link

当前使用的 Node.js 版本 (node -v)
(可用 node -v 命令 查看)
16.13.2

当前使用的 sequelize 版本
(package.json 所指定的版本)
6.17.0
问题描述
(描述出现的或寻求解决的问题)
我取出来的createdAt时间少8小时,我的数据库时区没问题
image
我的使用orm的脚手架去搭建的模型,在配置文件中使用了timezone:+8:00去修正了存入的时间,但是取出来的时间少了8小时
代码片段

"timezone": "+08:00"
模型的配置
createdAt: {
        allowNull: false,
        type: Sequelize.DATE,
        defaultValue: Sequelize.NOW
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE,
        defaultValue: Sequelize.NOW
      }
![image](https://user-images.githubusercontent.com/64049774/165505357-1aa664cf-cb8b-46e6-a1d2-2444ccb2e395.png)

![image](https://user-images.githubusercontent.com/64049774/165505453-661143ac-c92a-4b53-9929-45b648b10706.png)
 但是取出来的时间少了8个小时
// 相关代码或报错信息
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant