From 6ca7de946771d05a4006ecbaac3831b133b2f587 Mon Sep 17 00:00:00 2001 From: ilnaz <237x237@gmail.com> Date: Sun, 19 Jan 2025 10:44:58 +0300 Subject: [PATCH] feat: add start time and end time --- src/api/arm.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/arm.ts b/src/api/arm.ts index c370912..85d6013 100644 --- a/src/api/arm.ts +++ b/src/api/arm.ts @@ -1,4 +1,5 @@ import { getConfigValue } from '@brojs/cli'; +import dayjs from 'dayjs'; enum ArmEndpoints { ORDERS = '/arm/orders', @@ -9,12 +10,15 @@ const armService = () => { const endpoint = getConfigValue('dry-wash.api'); const fetchOrders = async ({ date }: { date: Date }) => { + let startDate = dayjs(date).startOf('day').toISOString(); + let endDate = dayjs(date).endOf('day').toISOString(); + const response = await fetch(`${endpoint}${ArmEndpoints.ORDERS}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify({ date }), + body: JSON.stringify({ startDate, endDate }), }); if (!response.ok) {