diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index 1f6975c73d..73d5cf9ce6 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -313,9 +313,10 @@ def serialize(self, value): """ if value is None: return value - if self.type in (CustomFieldTypeChoices.TYPE_DATE, CustomFieldTypeChoices.TYPE_DATETIME): - if type(value) in (date, datetime): - return value.isoformat() + if self.type == CustomFieldTypeChoices.TYPE_DATE and type(value) is date: + return value.isoformat() + if self.type == CustomFieldTypeChoices.TYPE_DATETIME and type(value) is datetime: + return value.isoformat() if self.type == CustomFieldTypeChoices.TYPE_OBJECT: return value.pk if self.type == CustomFieldTypeChoices.TYPE_MULTIOBJECT: