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

Add utc variant now for factory use #486

Open
whardier opened this issue Jul 21, 2020 · 2 comments
Open

Add utc variant now for factory use #486

whardier opened this issue Jul 21, 2020 · 2 comments

Comments

@whardier
Copy link

Using pendulum in pydantic has me writing code similar to Field(default_factory=lambda: now('UTC')) to ensure UTC regardless of system timezone settings. It would be nice to have a utcnow() variant that will allow for writing code similar to Field(default_factory=utcnow) ready and available with new versions of pendulum.

@whardier
Copy link
Author

We really do need pendulum.utcnow() to handle a common use case and simplify how we approach things with Pydantic schemas and the like.

@whardier
Copy link
Author

Nevermind.. looks like this exists as pendulum.datetime.DateTime.utcnow (after importing just DateTime)

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

1 participant