[Bug] roundTime_locale test fails in DST-observing timezones
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- node.js, typescript
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu với test/ut/spec/util/time.test.ts, đặc biệt là getISOTimezone() và test roundTime_locale, sau đó chạy npm run test trong một múi giờ có DST. Cập nhật phần xử lý múi giờ của test để các ngày được mong đợi sử dụng offset chính xác cho từng ngày, đồng thời xác nhận rằng toàn bộ test suite đều vượt qua trong các múi giờ có DST.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
6.0.0 (bug present on current master)
Link to Minimal Reproduction
N/A — this is a test-only bug. Run npm run test in any DST-observing timezone (US, EU, Australia, NZ, Brazil, etc.).
Steps to Reproduce
- Clone apache/echarts,
npm install - Set system timezone to any DST-observing zone (e.g., America/New_York, Europe/Berlin, Australia/Sydney)
- Run
npm run test - Observe
roundTime_localetest failure intest/ut/spec/util/time.test.ts
Current Behavior
FAIL test/ut/spec/util/time.test.ts
● util/time › roundTime › roundTime_locale
expect(received).toEqual(expected) // deep equality
Expected: 528526800000
Received: 528523200000
at Object.<anonymous> (spec/util/time.test.ts:166:18)
The 3,600,000ms difference (exactly 1 hour) is the DST offset.
Expected Behavior
All unit tests should pass regardless of the machine's timezone.
Root Cause
The getISOTimezone() helper in time.test.ts computes the UTC offset from new Date(0) (January 1, 1970) and applies that fixed offset string to construct expected dates across different months:
function getISOTimezone(): string {
const offsetMinutes = (new Date(0)).getTimezoneOffset(); // ← always January offset
// ...
}
// Then used for October dates:
new Date(\`1986-10-01T00:00:00.000\${timezoneStr}\`) // ← January offset applied to October
In DST-observing timezones, the offset in January differs from October. For example, US Eastern:
- January: UTC-5 (EST)
- October: UTC-4 (EDT)
So getISOTimezone() returns -05:00, but new Date('1986-10-01T00:00:00.000-05:00') constructs midnight EST, which is 1AM EDT. Meanwhile roundTime() correctly rounds to midnight local time (EDT), producing a 1-hour mismatch.
The roundTime_UTC test passes because it uses .toISOString() which is timezone-independent.
Environment
- OS: Any (macOS, Linux, Windows)
- Node: 18+
- Timezone: Any DST-observing timezone (fails in ~70% of world timezones)
- Ngôn ngữ chính
- TypeScript
- Star
- 67.7k
- Fork
- 19.9k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/echarts
-
[Bug] String formatter templates only replace the first occurrence of `{a}`/`{b}`/`{c}`Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
-
[Bug] Inverse axis collapses the grid with outerBoundsContain when a tick is near the axis edgeCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởen pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[Bug] The zoom cursor in the toolbox area is incorrectCó thể đã có người làm @waterWang đã nhận 98 ngày trước. Đang mởbug en pending
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Tất cả issue của apache/echarts
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mike-north/AgentMonitors#648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/ui#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày