arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Humanize more human version

Open Ione03 opened this issue 2 years ago • 2 comments

Increased ability to convert to yesterday instead of 1 day ago, or tomorrow instead of in 1 day. For example :


present = arrow.now() # september 29th (thursday)
past = present.shift(day=1) 
present.humanize(past)  # Tomorrow
past = present.shift(day=0) 
present.humanize(past)  # Just Now, if have second become 10 second ago etc... using existing arrow humanize function
past = present.shift(day=-1)
present.humanize(past)  # Yesterday
past = present.shift(day=-2)
present.humanize(past)  # Tuesday (only get days of week)
past = present.shift(day=-3)
present.humanize(past)  # Monday
past = present.shift(day=-4)
present.humanize(past)  # Sunday
past = present.shift(day=-5)
present.humanize(past)  # Saturday
past = present.shift(day=-6)
present.humanize(past)  # Friday
past = present.shift(day=-7)
present.humanize(past)  # Last Week
past = present.shift(day=-8)
present.humanize(past)  # september 21th (just get date, or use existing arrow humanize function)

I got inspiration from whatsapp app

Ione03 avatar Sep 29 '22 02:09 Ione03

Is there anybody working on this? If not I'd like to do it.

nijek avatar Oct 10 '22 21:10 nijek

@nijek you can give it a shot, I'm working on generating locales off of CLDR, so if you can work within the data and ranges they have, that would be great!

krisfremen avatar Oct 14 '22 01:10 krisfremen