diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 74da8c8..b23c12b 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -396,9 +396,12 @@ class ActivityController extends Controller } }; } + $projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first(); foreach ($data['activities'] as $i => $activity_row) { - $startDate = \DateTime::createFromFormat('d-m-y', $activity_row['start_date']); - $endDate = \DateTime::createFromFormat('d-m-y H:i:sO', $activity_row['end_date']); + $startDate = \DateTime::createFromFormat('Y-m-d H:i:s.uP', $projectStart->mulai_proyek); + $endDate = clone $startDate; + $endDate->modify('+'.$activity_row['duration'].' days'); + $endDate->setTime(23, 59, 59); $input['name'] = $activity_row['name']; $input['proyek_id'] = $projectId; $input['version_gantt_id'] = $data['ganttId'];