In a Rails console, I got the following:
[18] rsp(#<Job>) » Date.today
=> Fri, 23 Aug 2019
[19] rsp(#<Job>) » Date.tomorrow
=> Sun, 25 Aug 2019
Ruby supplies today
while Rails supplies tomorrow
Looking at the source of tomorrow
, I see that it is Date.current.tomorrow
, and discover
[21] rsp(#<Job>) » Date.current
=> Sat, 24 Aug 2019
[22] rsp(#<Job>) » Date.today
=> Fri, 23 Aug 2019
Date.current
is not Date.today
?
One is apparently using my current time zone, while the other one is using UTC??? Is there some rationale for this? It seems rather counterintuitive that today
and tomorrow
would not be parallel in this respect. Is this just an unfortunate accident based on what different design choices being made over time, or is there something else going on here, with a more logical explanation?
Is this a well-known trap that I have simply not bumped into before? Is there some standard way of making the two behave like each other to avoid such an error-prone situation?