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

This commit is contained in:
Torsten Schulz (local)
2026-04-29 15:51:55 +02:00
parent b2ede3f525
commit eb6f1e19a4
2 changed files with 4 additions and 7 deletions

View File

@@ -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') }),
],
};
}

View File

@@ -67,6 +67,7 @@ export default {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-fit: contain;
object-position: center;
}
</style>