feat: profit chart in statistics

This commit is contained in:
2024-11-15 15:19:14 +04:00
parent 90530f0530
commit 608a063369
22 changed files with 515 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
export const getDefaultDates = (): [Date, Date] => {
const dateTo = new Date();
const dateFrom = new Date();
dateFrom.setDate(dateTo.getDate() - 28);
return [dateFrom, dateTo];
};
export const dateToString = (date: Date | null) => {
if (date === null) return null;
const month = date.getMonth() + 1;
const day = date.getDate();
const monthStr = month < 10 ? `0${month}` : month;
const dayStr = day < 10 ? `0${day}` : day;
return `${date.getFullYear()}-${monthStr}-${dayStr}`;
};