arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.73k stars 680 forks source link

Humanize should be more dynamic #973

Open c0dezer019 opened 3 years ago

c0dezer019 commented 3 years ago

Feature Request

humanize is great, and being able to specify granularity is great, but it needs to be more dynamic. Say, for instance, we want to to specify how long ago something happened in years, months, weeks, days, hours, and seconds. However, let's say that it only happened 5 hours ago. Notice how I didn't say 0 years, 0 months, 0 weeks, 0 days, 5 hours, and 0 seconds from now. I just said 5 hours. So if a value is 0 say 0 years, months, days, seconds, etc, it doesn't include that bit in the humanized time string.

Now let's say we add 12 seconds to that 5 hours...5 hours and 12 seconds ago. Now let's say a day goes by so now the string evolves into something like 1 day, 2 hours, 3 minutes, and 2 seconds ago. And the same goes for weeks, months, so on and so on.

anishnya commented 3 years ago

I think this is something we could definitely implement. Thoughts @jadchaar @systemcatch? If we choose to add this feature, I could add it into #971.

systemcatch commented 3 years ago

@anishnya I like the idea but tend to think we keep it in a separate PR to avoid the refactor getting too big.