arrow icon indicating copy to clipboard operation
arrow copied to clipboard

Bulk feature request: support timedeltas, milliseconds and below

Open bersbersbers opened this issue 6 years ago • 4 comments

I would like to use arrow's humanize() for the bold part of this:

Task has completed in 10 seconds. With 1000 subtasks, that is 10 milliseconds per subtask.

Currently, this seems hard for two reasons. First, from the start time that I stored, I need to compute the delta to now myself, divide the delta by 1000, subtract it from now, and then output that. That seems unncessarily complicated.

Second, everything below one second is "a moment" or something like that.

Or have I missed anything?

bersbersbers avatar Aug 29 '19 13:08 bersbersbers

Hello @bersbersbers the first part could be achieved as;

start_date.humanize(only_distance=True)
'10 seconds'

For the second part I don't think humanize would be much help, seems like you want a custom function here.

systemcatch avatar Aug 31 '19 21:08 systemcatch

Yes, that custom function is exactly what I am asking for - hence the "feature request" :) I am currently using humanize.naturaldelta() from https://github.com/jmoiron/humanize, it's just that that package is not maintained any longer.

bersbersbers avatar Aug 31 '19 21:08 bersbersbers

Ah ok I think I understand what you mean now.

@jadchaar what do you think?

systemcatch avatar Sep 03 '19 19:09 systemcatch

I think this could definitely be a great feature addition to Arrow. We could maybe combine this with dehumanize functionality in a future release.

jadchaar avatar Sep 04 '19 01:09 jadchaar