[WEB-2342] fix: datetime value format on property values response. (#970)

This commit is contained in:
Prateek Shourya
2024-09-02 15:16:38 +05:30
committed by GitHub
parent fdb76abc8b
commit 3bd6c83a3a

View File

@@ -5,6 +5,7 @@ from django.core.exceptions import ValidationError
from django.db.models import (
Q,
CharField,
Func,
)
from django.db.models.functions import Cast
from django.contrib.postgres.aggregates import ArrayAgg
@@ -52,8 +53,11 @@ class IssuePropertyValueEndpoint(BaseAPIView):
),
When(
property__property_type=PropertyTypeEnum.DATETIME,
then=Cast(
F("value_datetime"), output_field=CharField()
then=Func(
F("value_datetime"),
function="TO_CHAR",
template="%(function)s(%(expressions)s, 'YYYY-MM-DD')",
output_field=CharField(),
),
),
When(