-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
Initialize from existing datetime.date
object?
#250
Comments
from datetime import datetime as dt
import pendulum
pendulum.instance(dt.fromordinal(date_object.toordinal())) This should work. Edit: pendulum.datetime(date.year,date.month,date.day) |
Could we add that behavior to |
+1 |
+1 I would also check for |
+1 This would be a great addition to the API! |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
I would like to pump this. I find doing this over and over and would love if pendulum had this feature built in. |
This is a no-brainer for me. I work with an ORM that returns |
+1 |
I have created a first draft at https://github.com/kakulukia/pendulum .. im missing some tests before opening a puss request, but like to get some feedback first. |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+1 ! |
I've also looked into the documentation & the code in search for this behavior. In the code, I see that even the shorthand class functions to initialize a Lines 740 to 755 in c4e518c
|
pendulum.instance(dt)
works fordatetime.datetime
, but how can I initialize a Pendulum object from an existingdatetime.date
(specifically a DjangoDateField
)?My current workaround:
The text was updated successfully, but these errors were encountered: