-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy-data.js
57 lines (51 loc) · 1.67 KB
/
dummy-data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const DUMMY_EVENTS = [
{
id: "e1",
title: "Programming for everyone",
description:
"Everyone can learn to code! Yes, everyone! In this live event, we are going to go through all the key basics and get you started with programming as well.",
location: "Somestreet 25, 12345 San Somewhereo",
date: "2021-05-12",
image: "images/coding-event.jpg",
isFeatured: false,
},
{
id: "e2",
title: "Networking for introverts",
description:
"We know: Networking is no fun if you are an introvert person. That's why we came up with this event - it'll be so much easier. Promised!",
location: "New Wall Street 5, 98765 New Work",
date: "2021-05-30",
image: "images/introvert-event.jpg",
isFeatured: true,
},
{
id: "e3",
title: "Networking for extroverts",
description:
"You probably need no help with networking in general. But focusing your energy correctly - that is something where most people can improve.",
location: "My Street 12, 10115 Broke City",
date: "2022-04-10",
image: "images/extrovert-event.jpg",
isFeatured: true,
},
];
export function getFeaturedEvents() {
return DUMMY_EVENTS.filter((event) => event.isFeatured);
}
export function getAllEvents() {
return DUMMY_EVENTS;
}
export function getFilteredEvents(dateFilter) {
const { year, month } = dateFilter;
let filteredEvents = DUMMY_EVENTS.filter((event) => {
const eventDate = new Date(event.date);
return (
eventDate.getFullYear() === year && eventDate.getMonth() === month - 1
);
});
return filteredEvents;
}
export function getEventById(id) {
return DUMMY_EVENTS.find((event) => event.id === id);
}