Skip to content

naive and aware constraints on datetime types #266

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

Closed
samuelcolvin opened this issue Sep 30, 2022 · 6 comments · Fixed by #343
Closed

naive and aware constraints on datetime types #266

samuelcolvin opened this issue Sep 30, 2022 · 6 comments · Fixed by #343

Comments

@samuelcolvin
Copy link
Member

Should be fairly easy since speedate gives offset as optional.

@antonagestam said he might be able to work on this, see pydantic/pydantic#3477 (reply in thread)

@antonagestam
Copy link
Contributor

A related note: I believe the "date-time" format of JSON Schema is considered timezone-aware. That means that the aware type should have it, but the naive should not.

It also means it's slightly weird that datetime.datetime has it but without enforcing it, IMO. It might be worth putting in some time into documenting these things, and perhaps recommending usage of aware over datetime.datetime?

@samuelcolvin
Copy link
Member Author

Totally agree, plan is to rewrite the documentation completely - on my long list of things to do.

@antonagestam
Copy link
Contributor

@samuelcolvin Cool, that's good to know! 👍

@samuelcolvin
Copy link
Member Author

samuelcolvin commented Sep 30, 2022

Just to be clear, speedate is part of the pydantic org, and I built it specifically for pydantic-core, so we can change it if required.

@antonagestam
Copy link
Contributor

I'm taking an initial look at this. Just setting up and familiarizing myself with the project etc, so I don't want to raise any expectations still, but thought I'd let you know 🙂

@samuelcolvin
Copy link
Member Author

That's great news, let me know if you have any questions. Good luck.

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

Successfully merging a pull request may close this issue.

2 participants