mirror of
https://framagit.org/enfance-libre/statistiques
synced 2025-12-07 07:23:44 +00:00
28 lines
883 B
TypeScript
28 lines
883 B
TypeScript
import { differenceInDays } from "date-fns";
|
|
import { computeIntervalProcedurePenale } from "./computeIntervalProcedurePenale";
|
|
import {
|
|
FamilleAvecInfosProceduresPenales,
|
|
InfosProcedurePenale,
|
|
} from "../computeFamilleAvecInfosProceduresPenales";
|
|
import { StatsValue } from "../../desc/StatsDesc";
|
|
|
|
export function computeIntervalProcureurTribunalCorrectionnel(
|
|
familles: FamilleAvecInfosProceduresPenales[]
|
|
): StatsValue {
|
|
return computeIntervalProcedurePenale(
|
|
familles,
|
|
(procPenal: InfosProcedurePenale): number | undefined => {
|
|
if (
|
|
procPenal.evtProcureur?.Date &&
|
|
procPenal.evtTribunalCorrectionnel?.Date
|
|
) {
|
|
return differenceInDays(
|
|
procPenal.evtTribunalCorrectionnel.Date,
|
|
procPenal.evtProcureur.Date
|
|
);
|
|
}
|
|
return undefined;
|
|
},
|
|
"IntervalProcureurTribunalCorrectionnel"
|
|
);
|
|
}
|