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

有个时区的问题,导致某些配置下显示的不是想要刻度 #15

Open
xiaoxuefengnian opened this issue Jul 12, 2023 · 0 comments

Comments

@xiaoxuefengnian
Copy link

有个时区的问题
当使用如下配置时,我期望的是时间戳刻度在那一天的 0 点,但实际是 8 点,因为 北京时间

 extendZOOM: [
        {
          zoom: 24 * 30, // 时间分辨率,整个时间轴表示的时间范围,单位:小时
          zoomHourGrid: 24 //时间分辨率对应的每格小时数,即时间轴上最小格代表多少小时
        },
      ]

这导致当我将按天播放,将时间设为某一天的 0 点时,中间线偏离了刻度

可做如下修改

constant.js

// 时区偏差毫秒数
export const TIMEZONE_OFFSET_STAMP = new Date().getTimezoneOffset() * 60 * 1000;

index.vue

// 起始偏移距离
      let msOffset =
        msPerGrid - ((this.startTimestamp - TIMEZONE_OFFSET_STAMP) % msPerGrid);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant