[BUG] Streak uses the UTC date instead of the user's local date
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
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react-native, typescript
- Lĩnh vực
- mobile
Hướng nghiên cứu
Bắt đầu tại src/utils/stats.ts, ở updateStreak, rồi so sánh cách xử lý ngày tháng với getWeekId trong src/types/weekUtils.ts. Chạy các bài kiểm thử streak hiện có, nếu có, và kiểm tra hành vi quanh nửa đêm theo giờ địa phương tại UTC+2 và phía tây UTC. Hoàn thành khi ngày của streak sử dụng lịch địa phương và định dạng YYYY-MM-DD được lưu vẫn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
updateStreak in src/utils/stats.ts computes "today" and "yesterday" from new Date().toISOString(), which gives the UTC calendar date. The rest of the planner (week ids, days) uses the local date (src/types/weekUtils.ts).
For users outside UTC, activity near midnight is recorded on the wrong day:
- In UTC+2 (e.g. Central Europe in summer), completing a block at 00:30 local time on Tuesday stores
lastActiveDateas Monday. - Two activities at 23:30 Monday and 00:30 Tuesday local time can land on the same UTC date, so the streak is not incremented even though the user was active on two consecutive local days.
- West of UTC the opposite happens in the evening.
Steps to reproduce
- Set the device timezone to UTC+2.
- Complete a block at 00:30 local time.
lastActiveDate(AsyncStorage@levelup/last_active) holds the previous day's date.
Expected behavior
Streak days follow the user's local calendar, consistent with the planner weeks.
Suggested fix
Build the date string from local fields (getFullYear(), getMonth(), getDate()), as getWeekId already does, and compute "yesterday" the same way. Existing users' stored lastActiveDate values stay valid (same YYYY-MM-DD format).
Found while writing tests; drafted with the help of Claude Code.
- Ngôn ngữ chính
- TypeScript
- Star
- 4
- Fork
- 4
- 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 GiZano/LevelUp
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
-
enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Tất cả issue của GiZano/LevelUp
Issue tương tự
-
clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster maturity:stable P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openclaw/openclaw#200937 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accepted bug needs-info triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
zts212653/clowder-ai#2025 · 1 bình luận ·
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 76/100
letehaha/moneymatter#906 ·
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 82/100
blinkospace/blinko#1287 ·
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 85/100
Feyisara2108/stellargive#1379 ·
Maintainer thường phản hồi trong vòng 1 ngày