Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'in:' kwarg in Time.new and Time.now #432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcfadden
Copy link

This adds support for Ruby 3.1's in: keyword argument.

Example usage:

Timecop.freeze(Time.new(2024, 9, 20, 1, 2, 30)) do
  puts Time.new # 2024-09-20 01:02:30 -0400
  puts Time.new(in: "+04:00") # 2024-09-20 09:02:30 +0400
  puts Time.now(in: "+03:00") # 2024-09-20 08:02:30 +0300
  puts Time.new(in: "+02:00") # 2024-09-20 07:02:30 +0200
end

Fixes #431

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.

Time.new with in: keyword argument does not return frozen time.
1 participant