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

380 week of year fix #406

Closed joshuacronemeyer closed 1 year ago

joshuacronemeyer commented 1 year ago

While I was trying to handle the non-commercial week of the year (which is where the week starts on a sunday). I realized there were scenarios where you could mix commercial date stuff with non-commercial date stuff so had to come up with a consolidated way to handle that. I came up with always converting day of week to a monday start based day of week.

This made all our other scenarios pass without so much conditional logic and seems to handle this mix/match stuff as well.