timex icon indicating copy to clipboard operation
timex copied to clipboard

Timex.format seems off at the end of the month

Open nwittstruck opened this issue 2 years ago • 0 comments

Steps to reproduce

iex> in_5_months = Timex.shift(Timex.now(), months: 5)   
~U[2023-06-30 07:51:27.003055Z]
iex> Timex.format!(in_5_months, "{relative}", :relative) 
"in 4 months"

Description of issue

  • Timex.format seems to miss a month - the result should be "in 5 months", instead of "in 4 months". The output of Timex.shift looks good.
  • It seems the error is only occuring starting recently, it was fine before.
  • At first I thought it was because due to me testing on the 31st. But apparently the issue is not related to the date. I guess it depends if Timex.format does some rounding? Otherwise 5 months - a few secons is already 4 months. It works fine if I add another hour. I'm just curious why it worked before.

Could this be related to this issue? https://github.com/bitwalker/timex/issues/535

I hope I didn't miss any other open issue related to this. Thank you for the great work!

nwittstruck avatar Jan 31 '23 07:01 nwittstruck