How is it possible to find the date based on the current year's day? For example, you have the year's day 235, which date does it corresponds to?
For example, you can find a year's day as follows:
Date.today.yday
#=> 126 (for May 6, 2021)
How to achieve the opposite?
Date.some_method(126)
#=> 2021-05-06
I tried as follows:
now = Date.today
#=> Thu, 06 May 2021
start_year = now.beginning_of_year
#=> Fri, 01 Jan 2021
start.advance(days: (start.yday + 126))
#=> Sat, 08 May 2021
Why there is a difference of 2 days?