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

Bug: 时区不同导致前端报错 #21

Closed
Viyerelu23333 opened this issue Jan 17, 2022 · 2 comments
Closed

Bug: 时区不同导致前端报错 #21

Viyerelu23333 opened this issue Jan 17, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Viyerelu23333
Copy link

可能与 #2 相关。
在部署时发现,时区错误(笔记时间在未来时)会导致网页无法加载/提交笔记,刷新后提示「😭 请求数据失败了」。此时数据库内有笔记、API 正常响应,但日期在未来。影响范围不只是时区设置错误,跨时区访问也可能会造成此问题。

 是否可以在后端使用 UNIX 时间戳来存放日期,前端解析到本机时区呢?

若部署在「Asia/Shanghai」,尝试将系统调整为「UTC」,发布笔记后应该可以复现。


一些不相关的问题:

  • 数据库若是要更新,请问如何迁移原有数据啊;
  • 在自建部署时,网页仍会加载 Google Analytics。
@boojack boojack added the bug Something isn't working label Jan 17, 2022
@boojack boojack self-assigned this Jan 17, 2022
@boojack
Copy link
Collaborator

boojack commented Jan 17, 2022

是否可以在后端使用 UNIX 时间戳来存放日期,前端解析到本机时区呢?

正好目前正在做后台数据库关于 createdAt/updatedAt 和 ID 的重构,准备用时间戳来存 createdTs/updatedTs。

数据库若是要更新,请问如何迁移原有数据?

因为正处于开发中,我尽量保证较少的涉及到数据库 schema 变更,但如果有需要更改的话(如上),想到了几种方法:

  1. 新增数据的导出导入功能;
  2. 另起一个平台来可视化管理 .db 文件;(更倾向于这种)

在自建部署时,网页仍会加载 Google Analytics

这个可以去掉。

@rebron1900
Copy link
Contributor

rebron1900 commented Jan 17, 2022

个人觉得第一个方式更好,以后的导入导出肯定要做的。
第二个方案又要做一套交互逻辑觉得没这个必要,精力可以花在其他更重要的事上面,一个以后来做也可以

@boojack boojack closed this as completed May 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants