V2.5 : VOICI LES MODIFICATIONS MAJEURS APPRTÉES DANS CETTE VERSION :

-> (BÉTA) : SYSTÈME D'ANNONCES EN GARE VIA UN MODEL IA DE SIMONE HERAULT.
This commit is contained in:
Ferrovia committed 2026-07-02 22:22:37 +02:00
1 parent ad3fc8938c
commit ad999aa44f
14 files changed
+517 -62

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
const horaires = [{ heure_depart: '21:00', numero_train: '123' }];
const isArrival = false;
const currentTime = new Date();
currentTime.setHours(20, 55, 0, 0);
for (const train of horaires) {
const numTrain = train.num_train || train.numero_train || train.numero;
const timeStr = isArrival
? (train.heure_arrivee || train.arrival_time || train.time || train.heure)
: (train.heure_depart || train.departure_time || train.time || train.heure);
let trainTime;
if (typeof timeStr === 'string' && timeStr.length <= 5 && timeStr.includes(':')) {
const [hh, mm] = timeStr.split(':');
trainTime = new Date(currentTime);
trainTime.setHours(parseInt(hh, 10), parseInt(mm, 10), 0, 0);
} else {
trainTime = new Date(timeStr);
}
const diffMs = trainTime.getTime() - currentTime.getTime();
const diffMins = Math.floor(diffMs / 60000);
console.log(`numTrain=${numTrain}, timeStr=${timeStr}, diffMins=${diffMins}`);
}