Added Charts

This commit is contained in:
2026-04-11 20:49:01 +10:00
parent e83fd3bdca
commit 95624f345c
16 changed files with 979 additions and 386 deletions
@@ -19,12 +19,18 @@ const props = defineProps<{
upcomingFlights: Flight[]
}>()
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
const monthIndex = (f: Flight): number => {
const date = new Date(f.departure_date)
return Number(new Intl.DateTimeFormat('en', {
timeZone: f.departure_airport.timezone,
month: 'numeric',
}).format(date)) - 1 // numeric returns 1-12, convert to 0-indexed
}
const countByMonth = (list: Flight[]) =>
MONTHS.map((_, i) =>
list.filter(f => new Date(f.departure_date).getMonth() === i).length
)
MONTHS.map((_, i) => list.filter(f => monthIndex(f) === i).length)
const series = computed(() => [
{ name: 'Flown', data: countByMonth(props.flights) },