fix: sort stock and bond events by payment date
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
} 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 StockPageVm = ReturnType<typeof useStockPageVm>;
|
||||
|
||||
@@ -93,9 +93,7 @@ function useStockPageVm() {
|
||||
dividends.data?.dividends
|
||||
.filter(event => event.timing !== "upcoming")
|
||||
.toSorted((a, b) =>
|
||||
(b.recordDate ?? b.paymentDate ?? "").localeCompare(
|
||||
a.recordDate ?? a.paymentDate ?? "",
|
||||
),
|
||||
compareDateDesc(a.paymentDate, b.paymentDate),
|
||||
) ?? [],
|
||||
period,
|
||||
position: position.data,
|
||||
@@ -113,9 +111,7 @@ function useStockPageVm() {
|
||||
dividends.data?.dividends
|
||||
.filter(event => event.timing === "upcoming")
|
||||
.toSorted((a, b) =>
|
||||
(a.recordDate ?? a.paymentDate ?? "").localeCompare(
|
||||
b.recordDate ?? b.paymentDate ?? "",
|
||||
),
|
||||
compareDateDesc(b.paymentDate, a.paymentDate),
|
||||
) ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user