🖥

#ruby の Timecop.freeze で Date を渡すと日付がずれるので Time.local を渡した方が良いかも

に公開

Passing Date with # ruby's Timecop.freeze will cause the date to shift, so it may be better to pass Time.local

Timecop.freeze Date.new(2019, 01, 01)
# => 2018-12-31 15:00:00 +0000

Date.today
# => Mon, 31 Dec 2018

Timecop.freeze ::Time.local(2019, 01, 01)
# => 2019-01-01 00:00:00 +0000

Date.today
# => Tue, 01 Jan 2019

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2297

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-08-16

Discussion