Skip to content

Commit 1db5a9d

Browse files
committed
fix: date not in utc, do not sanitize server-side
1 parent 9025696 commit 1db5a9d

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

src/app/dashboard/performance/transaction-categories-history/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const today = DateTime.now();
3434

3535
export default function TransactionCategoriesPage() {
3636
const [dateRange, setDateRange] = useState<DateRange>({
37-
from: today.startOf("month").startOf("day").toUTC().toJSDate(),
38-
to: today.endOf("month").endOf("day").toUTC().toJSDate(),
37+
from: today.startOf("month").startOf("day").toJSDate(),
38+
to: today.endOf("month").endOf("day").toJSDate(),
3939
});
4040

4141
const rangeLabel = useMemo(() => {

src/server/api/routers/transaction.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
TransactionType,
1515
} from "@prisma/client";
1616
import { DECIMAL_ZERO } from "~/utils/number";
17-
import { endOfDay, startOfDay } from "date-fns";
1817

1918
const ALLOWED_SORT_FIELDS = ["id", "timestamp"] as const;
2019
export type SortField = (typeof ALLOWED_SORT_FIELDS)[number];
@@ -215,8 +214,8 @@ export const transactionRouter = createTRPCRouter({
215214
}),
216215
)
217216
.query(async ({ ctx, input }) => {
218-
const fromDate = startOfDay(input.fromDate);
219-
const toDate = endOfDay(input.toDate);
217+
const fromDate = input.fromDate;
218+
const toDate = input.toDate;
220219

221220
const [rangeStart, rangeEnd] =
222221
fromDate <= toDate ? [fromDate, toDate] : [toDate, fromDate];
@@ -239,9 +238,6 @@ export const transactionRouter = createTRPCRouter({
239238
},
240239
});
241240

242-
console.log("ciaooooooooooooo");
243-
console.log(groupedByCategory);
244-
245241
if (!groupedByCategory.length) {
246242
return [];
247243
}
@@ -271,9 +267,6 @@ export const transactionRouter = createTRPCRouter({
271267
transactionCount: number;
272268
};
273269

274-
console.log("ciaooooooooooooo");
275-
console.log(groupedByCategory);
276-
277270
return groupedByCategory
278271
.map<CategoryAggregate | null>((group) => {
279272
const category = categoryById.get(group.categoryId);

0 commit comments

Comments
 (0)