fix: a day off on input

This commit is contained in:
tiennm99 committed 2025-07-08 12:27:34 +07:00
1 parent 3915f6231e
commit bf9bd07ad2
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -105,7 +105,7 @@ export async function POST(request) {
{ status: 400, headers: { "Content-Type": "application/json" } }
);
}
const dates = getDateRange(new Date(startDate), new Date(endDate));
const dates = getDateRange(startDate, endDate);
const results = [];
for (const date of dates) {
let rate = null;
+3 -3
View File
@@ -3,7 +3,7 @@
import React, { useState } from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import { parse, isDate } from "date-fns";
import { parse, isDate, format } from "date-fns";
export default function ExchangeRateViewer({
defaultStartDate,
@@ -52,8 +52,8 @@ export default function ExchangeRateViewer({
"Content-Type": "application/json",
},
body: JSON.stringify({
startDate: start.toISOString().split("T")[0],
endDate: end.toISOString().split("T")[0],
startDate: format(start, 'yyyy-MM-dd'),
endDate: format(end, 'yyyy-MM-dd'),
bank: selectedBank,
}),
});