Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address Pendulum Retort #428

Closed
Mikaayenson opened this issue Apr 3, 2017 · 3 comments
Closed

Address Pendulum Retort #428

Mikaayenson opened this issue Apr 3, 2017 · 3 comments

Comments

@Mikaayenson
Copy link

Pulled from the pendulum site: https://github.com/sdispater/pendulum

Let's address these cases natively.

Arrow is the most popular datetime library for Python right now, however its behavior and API can be erratic and unpredictable. The get() method can receive pretty much anything and it will try its best to return something while silently failing to handle some cases:

arrow.get('2016-1-17')

<Arrow [2016-01-01T00:00:00+00:00]>

pendulum.parse('2016-1-17')

<Pendulum [2016-01-17T00:00:00+00:00]>

arrow.get('20160413')

<Arrow [1970-08-22T08:06:53+00:00]>

pendulum.parse('20160413')

<Pendulum [2016-04-13T00:00:00+00:00]>

arrow.get('2016-W07-5')

<Arrow [2016-01-01T00:00:00+00:00]>

pendulum.parse('2016-W07-5')

<Pendulum [2016-02-19T00:00:00+00:00]>

Working with DST

just_before = arrow.Arrow(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
just_after = just_before.replace(microseconds=1)
'2013-03-31T02:00:00+02:00'

Should be 2013-03-31T03:00:00+02:00

(just_after.to('utc') - just_before.to('utc')).total_seconds()
-3599.999999

Should be 1e-06

just_before = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris')
just_after = just_before.add(microseconds=1)
'2013-03-31T03:00:00+02:00'

(just_after.in_timezone('utc') - just_before.in_timezone('utc')).total_seconds()
1e-06

@AlJohri
Copy link

AlJohri commented Sep 21, 2018

related #72

@systemcatch
Copy link
Collaborator

#91 #456 (and I'm sure there are others) talk about the problem of get() returning something even if it's terribly wrong. The possible solutions tend to be either adding a kwarg that makes parsing really strict and fail instead of returning garbage, or changing the behavior entirely. The latter would have to be done with deprecation warnings since it's sure to break many people's code.

DST problems are known (there is a milestone for them), we just need someone to take a detailed look at fixing it.

PR's are welcome on these issues.

@jadchaar
Copy link
Member

jadchaar commented Aug 5, 2019

Just wanted to add this in here: we are addressing a number of these issues in the upcoming 0.15.0 release. See details here: #612.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants