mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 01:32:24 +03:00
improve backward compatibility
by using date's class contructor instead of fromisostring
This commit is contained in:
parent
a61ee3f03d
commit
3dcdc01cd1
|
@ -41,7 +41,7 @@ class MyModelSerializerWithMethod(serializers.ModelSerializer):
|
|||
fields = "__all__"
|
||||
|
||||
def get_days_since_last_edit(self, obj):
|
||||
now = datetime.date.fromisoformat("2020-01-08")
|
||||
now = datetime.date(2020, 1, 8)
|
||||
return (now - obj.last_edited).days
|
||||
|
||||
|
||||
|
@ -231,7 +231,7 @@ def test_perform_mutate_success():
|
|||
mock_info(),
|
||||
**{
|
||||
"cool_name": "Narf",
|
||||
"last_edited": datetime.date.fromisoformat("2020-01-04"),
|
||||
"last_edited": datetime.date(2020, 1, 4),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user