今日ボタンが朝9時前に前日を表示する問題を修正 - #376
Merged
Merged
Conversation
nay
marked this pull request as ready for review
July 30, 2026 22:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
サイドバーの「今日」ボタンが、日本時間の朝9時より前に押すと前日を表示する問題(#283)を修正しました。
原因と対応
config.time_zone = 'Tokyo'がconfig/initializers/time_zone_and_locale.rbに置かれていましたが、config.time_zoneは Rails 本体の初期化中に読み取られるため、initializer に書いても反映されず、アプリは UTC で動作していました。UTC は JST より9時間遅れのため、朝9時まではTime.zone.todayが前日になりますconfig/application.rbに戻し、initializer を削除しました。ロケール設定(こちらは i18n 側の仕組みにより偶然機能していました)も同じ理由で一緒に戻しています影響範囲
date型カラムのため既存データへの影響はありませんcreated_at等のタイムスタンプの表示が UTC から JST に変わります(本来意図された動作への回復です)Closes #283