Available filtering parameters for events.
These can be used to fetch specific events, e.g. on a certain date, etc.
When specifying these parameters, only the date part is interesting.
This means that you do not need to account for the hour, minute, etc.
The specified date(s) will automatically be converted into the correct format,
so you can safely pass in a full date using e.g. new Date().
before and after may be specified at the same time, but date will
always take precedence. If date is specified, before and after will
be ignored.
Note that excludeOids will not have any effect if oid (first parameter) is set.
example
Fetching events that occurs on a date
// Fetch all events that occurs today.// Note that the date will be automatically converted into the// correct timezone when parsed at the server (UTC+2).const { data } =useEvents(null, { date: newDate() })
example
Fetching events that occurs after a specified date
// Fetches all events that occurs after today (not including today).const { data } =useEvents(null, { after: newDate() })
example
Fetch events for a single nation
// Fetches events that is created by nation with oid 400const { data } =useEvents(400)// Of course, you may still specify query parameters:const { data } =useEvents(400, { page: 2, amount: 5, after: newDate() })
example
Passing in the selected nation as a state variable (or prop)
const [oid, setOid] = useState(null)
const { data } = useEvent(oid, { date: new Date() })
@example Exclude events from selected nations```javascript// Fetches events that is not created by the nations with oid 400 and 405const { data } = useEvents(null, { after: new Date(), excludeOids: [400, 405] })
@example Exclude events with selected categories
// Fetches events that is not of categories with ids 1, 2 or 3const { data } =useEvents(null, { excludeCategories: [1, 2, 3] })
@example Fetch events for single category
// Fetches events that has category with id 1const { data } =useEvents(null, { category: 1 })
@example Fetch events that is only open for students
// You can also set it to false to only include events that// does not require you to be a student.const { data } =useEvents(null, { onlyStudents: true })
@example Fetch events that is only open if you are a member of the nation
// You can also set it to false to only include events that// does not require you to be a member of the nationconst { data } =useEvents(null, { onlyMembers: true })
Available filtering parameters for events. These can be used to fetch specific events, e.g. on a certain date, etc.
When specifying these parameters, only the date part is interesting. This means that you do not need to account for the hour, minute, etc. The specified date(s) will automatically be converted into the correct format, so you can safely pass in a full date using e.g.
new Date()
.before
andafter
may be specified at the same time, butdate
will always take precedence. Ifdate
is specified,before
andafter
will be ignored.Note that
excludeOids
will not have any effect ifoid
(first parameter) is set.Fetching events that occurs on a date
Fetching events that occurs after a specified date
Fetch events for a single nation
Passing in the selected nation as a state variable (or prop) const [oid, setOid] = useState(null) const { data } = useEvent(oid, { date: new Date() })
@example Exclude events with selected categories
@example Fetch events for single category
@example Fetch events that is only open for students
@example Fetch events that is only open if you are a member of the nation