Refactor event date comparison: Update buildUpcomingWhere function to use CURDATE for fixed-date events, improving accuracy in event filtering. Adjust image styling in ImageContent.vue to use object-fit: contain and center positioning for better layout consistency.
All checks were successful
Deploy miriamgemeinde / deploy (push) Successful in 6s
All checks were successful
Deploy miriamgemeinde / deploy (push) Successful in 6s
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
const { Event, Institution, EventPlace, ContactPerson, EventType, EventContactPerson, sequelize } = require('../models');
|
||||
const { Op, fn, col, where: sequelizeWhere } = require('sequelize');
|
||||
const { format, startOfDay } = require('date-fns');
|
||||
|
||||
function buildUpcomingWhere() {
|
||||
// Compare on date-only level to avoid timezone/DATETIME offset issues.
|
||||
const todayDate = format(startOfDay(new Date()), 'yyyy-MM-dd');
|
||||
return {
|
||||
[Op.or]: [
|
||||
// Fixed-date events: only today or future.
|
||||
sequelizeWhere(fn('DATE', col('date')), { [Op.gte]: todayDate }),
|
||||
// Recurring/undated events: date is null (dayOfWeek may be set).
|
||||
{ date: { [Op.eq]: null } },
|
||||
// Fixed-date events: only today or future (date-only compare).
|
||||
sequelizeWhere(fn('DATE', col('date')), { [Op.gte]: fn('CURDATE') }),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ export default {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user