updates on the changes arelated toe the order creation and delivery fixes as well

This commit is contained in:
2026-08-13 11:26:58 +05:30
parent fabb74c326
commit b1efd14749
10 changed files with 125 additions and 56 deletions

View File

@@ -6,6 +6,7 @@ import { Box, Paper, TextField, Typography } from '@mui/material';
import { MdCalendarMonth } from 'react-icons/md';
import dayjs from 'dayjs';
import { parseDoormileTimestamp } from 'utils/doormileTimestamp';
import { fetchDeliveries } from 'pages/api/api';
import Loader from 'components/Loader';
@@ -111,10 +112,12 @@ const Profitability = () => {
rider.orders.forEach((o) => {
const status = String(o.orderstatus || '').toLowerCase();
if (SKIPPED_STATUSES.has(status)) return;
// parseDoormileTimestamp (not bare dayjs()) avoids the false-trailing-Z
// parse bug (utils/doormileTimestamp.js) — see ProfitabilitySection.js.
const dateStr = o.assigntime
? dayjs(o.assigntime).format('YYYY-MM-DD')
? parseDoormileTimestamp(o.assigntime).format('YYYY-MM-DD')
: o.deliverydate
? dayjs(o.deliverydate).format('YYYY-MM-DD')
? parseDoormileTimestamp(o.deliverydate).format('YYYY-MM-DD')
: null;
if (dateStr !== selectedDate) return;
const km = parseFloat(o.riderkms || 0);