LoginSignup
1
0

More than 1 year has passed since last update.

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

Last updated at Posted at 2019-08-16

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

チャットメンバー募集

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

Twitter

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0