4 ms·
What benefits does this have over [Delorean](http://delorean.readthedocs.io/en/latest/ http://delorean.readthedocs.io/en/latest/)? The README for Pendulum seem
by josefdlange 10y ago
What benefits does this have over [Delorean](http://delorean.readthedocs.io/en/latest/ http://delorean.readthedocs.io/en/latest/)?
The README for Pendulum seems to show me one feature Delorean doesn't explicitly have -- `is_weekend()` -- otherwise these libraries are conceptually very similar.
I do agree that this (and Delorean) is a usability improvement over `datetime` and perhaps even Arrow (though I'm not tremendously familiar with Arrow).
- ak217 10y agoSo far I haven't seen either of these libraries do substantially better than datetime+dateutil+pytz at anything they claim to be good at.
- antar 10y agoarrow.get(value).humanize() How can I do this with datetime+dateutil+pytz?
- ak217 10y agoI was talking about delorean and pendulum (I think josefdlange edited his comment). I agree that arrow's multi-locale natural language renderer does add a lot of value. (Although I'd argue it should be unbundled into its own module, instead of Arrow trying to replace a ton of datetime/dateutil functionality.)
- masklinn 10y ago> I agree that arrow's multi-locale natural language renderer does add a lot of value. Although I'd argue it should be unbundled into its own module http://babel.pocoo.org/en/latest/api/dates.html http://babel.pocoo.org/en/latest/api/dates.html humanize is apparently a human-readable directioned delta, so that'd be format_timedelta(delta, add_direction=True) >>> print format_timedelta(ref - datetime.now(), add_direction=True) 1 hour ago >>> print format_timedelta(ref - datetime.now(), add_direction=True, locale='zh') 1小时前 >>> print format_timedelta(ref - datetime.now(), add_direction=True, locale='ru') 1 час назад
- josefdlange 10y agoNo editing here but that's okay. I only just came back to this conversation now :D I think Delorean, Pendulum, Arrow, etc, aim to make dealing with dates more understandable and less painful. It's perfectly possible to fully grasp all the technicalities of pytz/dateutil/datetime -- and I recommend that anybody who has to deal with dates and times in Python do so -- but if you'd rather not think about it all and are okay with deferring some control to the opinions of one of these libraries, that's when you probably pull them off the shelf instead of the aforementioned trio.
- dvl 10y agoI'm happy to not have to import 3 libraries anymore (2 that aren't part of standard library) to see if one date is greater than another or to add few days to a date.
- ak217 10y agoThey both import all three under the hood.
- sdispater 10y agoMainly, its API which tries to be as close as possible as the one provided by the standard datetime library while providing a bunch of helpful methods. Also, Pendulum is not just about datetimes but also provides both the Interval class and Period class which are improvements over the native timedelta class. And finally, it handles properly time shifting around DST transition times and normalization of datetimes when creating them which neither Delorean nor Arrow do well.