Skip to content

Commit f932ed7

Browse files
committed
replaced static accepted firs with regex gh-18
1 parent 1ed1414 commit f932ed7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/components/BookingComponentv3.jsx

+3-10
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ import {
1212

1313
import "../globals.css";
1414

15-
function isBookingAlive(start, end) {
16-
const currentDate = new Date();
17-
const startDate = new Date(start);
18-
const endDate = new Date(end);
19-
20-
return startDate <= currentDate && endDate
21-
}
22-
2315
const BookingComponent = () => {
2416
const [SessionToday, setSessionToday] = useState([]);
2517
const [BookingsToday, setBookingsToday] = useState([]);
@@ -42,10 +34,11 @@ const BookingComponent = () => {
4234

4335
var filterdSessions = [];
4436

45-
const acceptedFIRs = ["EK", "EN", "EF", "ES", "BI", "BG"];
37+
const acceptedFIRsRegex = /((EK[A-Z][A-Z]_)|(EF[A-Z][A-Z]_)|(BI[A-Z][A-Z]_)|(EN[A-Z][A-Z]_)|(ES[A-Z][A-Z]_))\w+/i;
4638

4739
for (const session of NetworkApiData.controllers) {
48-
if (acceptedFIRs.includes(session.callsign.slice(0, 2)) && session.facility > 0) {
40+
const callsign = session.callsign;
41+
if (acceptedFIRsRegex.test(callsign) && session.facility > 0) {
4942
filterdSessions = [...filterdSessions, session];
5043
}
5144
}

0 commit comments

Comments
 (0)