fix: sort stock and bond events by payment date

This commit is contained in:
2026-09-30 07:40:43 +03:00
parent 0bc8bc36b7
commit f5f4447d60
5 changed files with 33 additions and 17 deletions
+3 -7
View File
@@ -12,7 +12,7 @@ import { useBrokerageOperationHistory } from "@/entities/broker-operation";
import { section, useInstrumentParameters } from "@/features/instrument-details";
import { useScreenSync } from "@/features/tbank-connection";
import { apiErrorCode } from "@/shared/api";
import { instrumentLogoUrl } from "@/shared/lib";
import { compareDateDesc, instrumentLogoUrl } from "@/shared/lib";
type BondPageVm = ReturnType<typeof useBondPageVm>;
@@ -92,9 +92,7 @@ function useBondPageVm() {
coupons.data?.coupons
.filter(event => event.timing !== "upcoming")
.toSorted((a, b) =>
(b.paymentDate ?? b.recordDate ?? "").localeCompare(
a.paymentDate ?? a.recordDate ?? "",
),
compareDateDesc(a.paymentDate, b.paymentDate),
) ?? [],
period,
position: position.data,
@@ -110,9 +108,7 @@ function useBondPageVm() {
coupons.data?.coupons
.filter(event => event.timing === "upcoming")
.toSorted((a, b) =>
(a.paymentDate ?? a.recordDate ?? "").localeCompare(
b.paymentDate ?? b.recordDate ?? "",
),
compareDateDesc(b.paymentDate, a.paymentDate),
) ?? [],
};
}