You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Glad the library includes the pendulum DateTime now. I was just starting to use it but noticed it doesn't accept the standard python datetime objects as expected.
Steps to reproduce:
from pydantic_extra_types.pendulum_dt import DateTime
import datetime
import pydantic
class MyTest(pydantic.BaseModel):
my_pendulum_dt: DateTime
MyTest(my_pendulum_dt=datetime.datetime(2024,2,8,0,0,1))
pydantic_core._pydantic_core.ValidationError: 1 validation error for MyTest
my_pendulum_dt
value is not a valid timestamp [type=value_error, input_value=datetime.datetime(2024, 2, 8, 0, 0, 1), input_type=datetime]
Suggested fix:
Use pendulum.instance() for input of the type datetime.datetime before using pendulum.parse() for other types of input.
The text was updated successfully, but these errors were encountered:
Glad the library includes the pendulum DateTime now. I was just starting to use it but noticed it doesn't accept the standard python datetime objects as expected.
Steps to reproduce:
Expected results:
Actual results:
Suggested fix:
Use
pendulum.instance()
for input of the typedatetime.datetime
before usingpendulum.parse()
for other types of input.The text was updated successfully, but these errors were encountered: