[BUG] Streak uses the UTC date instead of the user's local date
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react-native, typescript
- 領域
- mobile
調査の方向性
src/utils/stats.ts の updateStreak から始め、src/types/weekUtils.ts の getWeekId と日付の扱いを比較してください。既存の streak テストがあれば実行し、UTC+2 および UTC より西の地域で、現地時間の午前0時前後の動作を確認してください。streak の日付が現地の暦を使い、保存される YYYY-MM-DD 形式が変わらないことをもって完了とします。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 4
- フォーク
- 4
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GiZano/LevelUp のほかの issue
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
似ている issue
-
agent-ready area: ui-server priority: p3 type: test
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
schlessera/brain-kit#4249 ·
メンテナーはふだん 1 日以内に返信
-
documentation tool triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
can1357/oh-my-pi#19608 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
dependencies tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
bcgov/nr-waste-plus#1549 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
blixvip/solana-tx-parse#18 ·