changes
This commit is contained in:
@@ -113,7 +113,13 @@ const currentMonthKey = () => {
|
||||
return `${date.getFullYear()}-${`${date.getMonth() + 1}`.padStart(2, '0')}`;
|
||||
};
|
||||
|
||||
const monthRange = (monthKey: string) => ({ startDate: `${monthKey}-01`, endDate: `${monthKey}-31` });
|
||||
const monthRange = (monthKey: string) => {
|
||||
const [yearText, monthText] = monthKey.split('-');
|
||||
const year = Number(yearText);
|
||||
const month = Number(monthText);
|
||||
const lastDay = new Date(year, month, 0).getDate();
|
||||
return { startDate: `${monthKey}-01`, endDate: `${monthKey}-${String(lastDay).padStart(2, '0')}` };
|
||||
};
|
||||
|
||||
export const getCashflowSummary = async (userId: string) => {
|
||||
const expenseRepo = AppDataSource.getRepository(Expense);
|
||||
|
||||
Reference in New Issue
Block a user