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

Default datetime string format changed in 3.0 release #800

Open
1 task done
gibsondan opened this issue Jan 29, 2024 · 2 comments
Open
1 task done

Default datetime string format changed in 3.0 release #800

gibsondan opened this issue Jan 29, 2024 · 2 comments

Comments

@gibsondan
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

The pendulum docs say "The default string representation is the same as the one returned by the isoformat() method."

This was true in Pendulum 2, but is no longer true in Pendulum 3. This could be a breaking change for users that are casting pendulum datetimes to strings.

In Pendulum 2:

>>> import pendulum
>>> str(pendulum.now())
'2024-01-29T16:00:38.678167-06:00'

In Pendulum 3:

>>> import pendulum
>>> str(pendulum.now())
'2024-01-29 16:00:23.305698-06:00'
>>> 
@edgarrmondragon
Copy link
Contributor

This changed to be consistent with the stdlib:

>>> import pendulum
>>> import datetime
>>> print(datetime.datetime.now(tz=datetime.timezone.utc))
2024-05-08 16:37:28.783379+00:00
>>> print(pendulum.now(tz=datetime.timezone.utc))
2024-05-08 16:37:31.622175+00:00

IMO it's a good, if breaking, change. It was also called out in the changelog but it should've probably had bold letters and indicated it's a breaking change.

@ndeslandesupgrade
Copy link

@edgarrmondragon all docs are still mentioning that default str representation is iso :)

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

3 participants