Skip to content

fix: sinceDate の算出を組織タイムゾーン基準にする#260

Merged
coji merged 2 commits intomainfrom
feat/256-sincedate-org-timezone
Mar 30, 2026
Merged

fix: sinceDate の算出を組織タイムゾーン基準にする#260
coji merged 2 commits intomainfrom
feat/256-sincedate-org-timezone

Conversation

@coji
Copy link
Copy Markdown
Owner

@coji coji commented Mar 30, 2026

Summary

Changes

  • reviews/index.tsx: timezoneContext をインポートし、dayjs.utc().tz(timezone).subtract(...).startOf('day').utc().toISOString() パターンに変更
  • feedbacks/_index/index.tsx: 同上

Test plan

  • pnpm validate が通る(lint, format, typecheck, build, test)
  • reviews ページが正常に表示される
  • feedbacks ページが正常に表示される
  • period 切り替え(1/3/6/12ヶ月, All time)が正常に動作する

Closes #256

Generated with spec-implement-accept skill

Summary by CodeRabbit

リリースノート

  • バグ修正
    • 分析(フィードバック・レビュー・在庫)ページで、ユーザーのタイムゾーンを正しく考慮した期間フィルタの計算を改善しました。期間指定時の境界日が現地時間に基づいて安定的に算出されます。
    • 「全期間」選択時の基準日時を統一し、一貫した表示・集計が行われるようになりました。

analysis/reviews と analysis/feedbacks の sinceDate 算出が UTC 固定だったのを、
analysis/inventory と同様に timezoneContext から組織タイムゾーンを取得して
日付境界を計算するように修正。

Closes #256

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf0ef3c1-f5c7-42f2-b981-43e17854f310

📥 Commits

Reviewing files that changed from the base of the PR and between 9268cac and 2a2f4a0.

📒 Files selected for processing (4)
  • app/libs/date-utils.ts
  • app/routes/$orgSlug/analysis/feedbacks/_index/index.tsx
  • app/routes/$orgSlug/analysis/inventory/index.tsx
  • app/routes/$orgSlug/analysis/reviews/index.tsx

📝 Walkthrough

Walkthrough

analysis の複数ルートで、組織タイムゾーンを使う共通ユーティリティ calcSinceDate(periodMonths, timezone) を導入し、各ローダーがタイムゾーンコンテキストから timezone を取得して sinceDate をそのユーティリティで算出するように変更されました。periodMonths === 'all' はユーティリティ側で固定日付に置き換えられています。

Changes

Cohort / File(s) Summary
Analysis reviews & feedbacks loaders
app/routes/$orgSlug/analysis/reviews/index.tsx, app/routes/$orgSlug/analysis/feedbacks/_index/index.tsx
ローダーが timezoneContext からタイムゾーンを取得し、従来の inline dayjs 算出を廃止して calcSinceDate(periodMonths, timezone) を使用するように差し替え。返却するフィールドやキャッシュロジックは維持。
Inventory loader
app/routes/$orgSlug/analysis/inventory/index.tsx
同様に inline dayjs 算出を calcSinceDate(periodMonths, timezone) 呼び出しへ置換。その他のロジックは不変。
Date utils
app/libs/date-utils.ts
新関数 `calcSinceDate(periodMonths: number

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 ぽょん、日付をそっと直したよ
タイムゾーンに合わせて跳ねる朝
月を数えて、境界をそろえて
データは正しく、レポートは嬉しそう
にんじん片手に、今日もバグゼロ祈願 ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは変更の主要な目的(sinceDate の算出を組織タイムゾーン基準にする)を正確に説明しており、変更セットの中心的な内容と完全に関連している。
Linked Issues check ✅ Passed PRの変更は#256の要件を完全に満たしている。reviews/feedbacks のsinceDate算出が UTC固定からタイムゾーン基準に変更され、inventory との統一パターンが実現されている。
Out of Scope Changes check ✅ Passed すべての変更は#256の要件範囲内である。calcSinceDate ユーティリティの抽出は既存ロジックの共通化で、スコープ内の改善であり、追加機能や関連のない変更は含まれていない。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/256-sincedate-org-timezone

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

reviews, feedbacks, inventory の 3 ファイルで重複していた
dayjs.utc().tz(timezone).subtract(...).startOf('day').utc().toISOString()
パターンを app/libs/date-utils.ts の calcSinceDate() に抽出。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coji coji merged commit ca81d7f into main Mar 30, 2026
6 checks passed
@coji coji deleted the feat/256-sincedate-org-timezone branch March 30, 2026 08:29
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

Successfully merging this pull request may close these issues.

sinceDate の算出を組織タイムゾーン基準にする

1 participant