featurehelp wanted
Metriche repository
- Star
- (1082 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
I'd like to see a feature like the following:
>>> p.date_diff(datetime.timedelta(minutes=-30))
'00:30:00 before'
>>> p.date_diff(5)
'00:00:05 after'
>>> p.date_diff(0)
'at'
I would expect one to use the result to produce nice output for a time difference like:
Your flight departed 00:00:05 after its scheduled departure.
It would be nice if it accepted a time formatter such that it could alternately emit:
>>> p.date_diff(datetime.timedelta(minutes=-30), fmt=nice_time)
'30 minutes before'
>>> p.date_diff(5, fmt=nice_time)
'five seconds after'
>>> p.date_diff(0, fmt=nice_time)
'at'
Perhaps that inflection is too trivial for a library like inflect. Or perhaps there are nuances I haven't yet considered.