Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timex.from_now unexpected result #720

Open
LostKobrakai opened this issue Aug 1, 2022 · 0 comments
Open

Timex.from_now unexpected result #720

LostKobrakai opened this issue Aug 1, 2022 · 0 comments

Comments

@LostKobrakai
Copy link

Steps to reproduce

timex 3.7.8

{:ok, dt, 0} = DateTime.from_iso8601("2022-07-30 17:06:27Z")
{DateTime.utc_now(), Timex.from_now(dt)}
# {~U[2022-08-01 08:20:03.093411Z], "yesterday"}

{:ok, dt, 0} = DateTime.from_iso8601("2022-07-29 17:17:39Z")
{DateTime.utc_now(), Timex.from_now(dt)}
# {~U[2022-08-01 08:21:43.460553Z], "2 days ago"}

Description of issue

  • What are the expected results?
    All of those results seem to be off by 1 day by my understanding.

Yesterday is the day before today, which from the perspective of 2022-08-01 is 2022-07-31, not 2022-07-30. Also in the same context I'd consider 2022-07-29 to be 3 days ago, though that one feels a bit more open to interpretation.

  • If you are certain this is a bug in Timex, do you have references I
    can use to check the algorithm/logic against? For instance, a well-established
    date/time library in another language, a paper, test suite, etc. It is by no
    means a requirement, but is immensely helpful in fixing bugs, and provides me
    extra data to use when building out the test suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant