travisjeffery / timecop

A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
MIT License
3.36k stars 223 forks source link

DateTime.parse("Wednesday 12:00") format is always returning midnight #418

Closed ptrela closed 3 months ago

ptrela commented 5 months ago

Hello, we're using Timecop in our project and we have a problem with DateTime.parse("Wednesday 15:00") format in RSpec. It returns midnight hour which is making our specs failed.

Without using Timecop DateTime.parse is working properly.

How to recreate:

> DateTime.parse("Tuesday 15:00")
Tue, 05 Mar 2024 00:00:00 +0000

I've added a PullRequest with Specs with my idea how to fix it. https://github.com/travisjeffery/timecop/pull/417 Sorry if i added this issue and PR in a wrong way, tried to do my best following the Readme.MD instructions.

After the fix we are receiving result like this:

DateTime.parse("Tuesday 15:00")
Tue, 05 Mar 2024 15:00:00 +0000
joshuacronemeyer commented 3 months ago

Fixed by PR #417