refactor(reporting): update date handling and logging in allocation controller

- Removed UTC conversion for start and end dates to maintain local date context.
- Enhanced console logging to reflect local date values for better debugging.
This commit is contained in:
chamiakJ
2025-05-20 08:06:05 +05:30
parent 1dade05f54
commit 819252cedd
3 changed files with 9 additions and 7 deletions

View File

@@ -413,13 +413,13 @@ export default class ReportingAllocationController extends ReportingControllerBa
let endDate: moment.Moment;
if (date_range && date_range.length === 2) {
// Parse dates and convert to UTC while preserving the intended local date
startDate = moment(date_range[0]).utc().startOf('day');
endDate = moment(date_range[1]).utc().endOf('day');
startDate = moment(date_range[0]).startOf('day');
endDate = moment(date_range[1]).endOf('day');
console.log("Original start date:", date_range[0]);
console.log("Original end date:", date_range[1]);
console.log("UTC startDate:", startDate.format());
console.log("UTC endDate:", endDate.format());
console.log("Local startDate:", startDate.format());
console.log("Local endDate:", endDate.format());
} else if (duration === DATE_RANGES.ALL_TIME) {
// Fetch the earliest start_date (or created_at if null) from selected projects
const minDateQuery = `SELECT MIN(COALESCE(start_date, created_at)) as min_date FROM projects WHERE id IN (${projectIds})`;
@@ -495,6 +495,8 @@ export default class ReportingAllocationController extends ReportingControllerBa
current.add(1, 'day');
}
console.log("workingDays", workingDays);
console.log("Start date for working days:", startDate.format());
console.log("End date for working days:", endDate.format());
// Use organization working hours for total working hours
const totalWorkingHours = workingDays * orgWorkingHours;

View File

@@ -7,5 +7,5 @@ export function startCronJobs() {
startNotificationsJob();
startDailyDigestJob();
startProjectDigestJob();
startRecurringTasksJob();
// startRecurringTasksJob();
}

View File

@@ -176,9 +176,9 @@ const TaskDetailsForm = ({ taskFormViewModel = null }: TaskDetailsFormProps) =>
<TaskDrawerBillable task={taskFormViewModel?.task as ITaskViewModel} />
</Form.Item>
<Form.Item name="recurring" label={t('taskInfoTab.details.recurring')}>
{/* <Form.Item name="recurring" label={t('taskInfoTab.details.recurring')}>
<TaskDrawerRecurringConfig task={taskFormViewModel?.task as ITaskViewModel} />
</Form.Item>
</Form.Item> */}
<Form.Item name="notify" label={t('taskInfoTab.details.notify')}>
<NotifyMemberSelector task={taskFormViewModel?.task as ITaskViewModel} t={t} />