Skip to content

Commit d197d6c

Browse files
[WEB-4766] fix: edit active cycle dates bugs (#3969)
* fix: datetime parser * chore: remove print statement * fix: if condition check * chore: remove unused imports * chore: code refacture
1 parent 7f47aa2 commit d197d6c

File tree

1 file changed

+7
-3
lines changed
  • apps/api/plane/app/views/cycle

1 file changed

+7
-3
lines changed

apps/api/plane/app/views/cycle/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import json
33
import pytz
44
from datetime import date, timedelta
5+
from dateutil.parser import parse as datetime_parse
6+
57

68
# Django imports
79
from django.contrib.postgres.aggregates import ArrayAgg
@@ -26,7 +28,7 @@
2628
from django.db.models.functions import Coalesce, Cast, Concat
2729
from django.utils import timezone
2830
from django.core.serializers.json import DjangoJSONEncoder
29-
from django.utils.dateparse import parse_date
31+
3032

3133
# Third party imports
3234
from rest_framework import status
@@ -390,13 +392,15 @@ def partial_update(self, request, slug, project_id, pk):
390392
cycle, data=request.data, partial=True, context={"project_id": project_id}
391393
)
392394

393-
if cycle.start_date is not None and cycle.end_date is not None:
395+
if request_data.get("start_date", None) and cycle.start_date and cycle.end_date:
394396
if (
395397
cycle.start_date.date() <= date.today()
396398
and cycle.end_date.date() >= date.today()
397399
):
398400
# Convert the given string date
399-
parsed_request_start_date = parse_date(request_data["start_date"])
401+
parsed_request_start_date = datetime_parse(
402+
request_data["start_date"]
403+
).date()
400404

401405
last_entity_progress = (
402406
EntityProgress.objects.filter(

0 commit comments

Comments
 (0)