Replies: 5 comments
|
@theavey thanks for taking the time to post this issue. Good suggestion! I agree that localization would be both useful, and hard. I think it'd be a good addition to However, priority-wise, I'll probably only get to it after the 1.0 release. My reasons for doing this:
|
I don't think this is quite the right characterization. It doesn't so much as skip localization as it does delegate it to I would definitely advise caution on the localization front. My perception is that its complexity is comparable to the complexity of the datetime library itself. A huge chunk of ICU4X is devoted to localizing datetimes. (The |
|
agree this is not (or should not be: not my place to say) a high priority If you wanted to delegate localization to the user/developer, could do something like def time_delta_in_words(
time_delta,
hours_word="hours",
minutes_word="minutes",
seconds_word="seconds",
nanos_word="nanoseconds",
join_word="and",
):
hmsn = time_delta.in_hrs_mins_secs_nanos()
list_output = [
f"{quantity} {word}"
for quantity, word in zip(
hmsn, (hours_word, minutes_word, seconds_word, nanos_word)
)
if quantity
]
if len(list_output) > 1:
list_output[-1] = f"{join_word} {list_output[-1]}"
return ", ".join(list_output) |
|
Another interesting idea is to integrate with humanize, which already supports expressing date & time in various languages. |
|
Whenever is cool but the only feature left-over for me to switch from Arrow is that |
Uh oh!
There was an error while loading. Please reload this page.
Hi there:
Just came across this recently and it looks very interesting for my use cases. So far, the only thing that I have seen that I would like added is some method similar to
Interval.in_words.It seems like it would be a pretty similar implementation to methods like
format_common_isoandin_hrs_mins_secs_nanos, but with the "niceness" of an easy-for-a-human-to-read format.IMO, the hardest part of this implementation would be localization, which is indeed a challenge.
This is obviously not a requirement for a functional datetime library, but I wanted to suggest what I saw as one of the more useful aspects of Pendulum.
All reactions