import React from 'react' import { FaCalendarAlt } from 'react-icons/fa' import dayjs from 'dayjs' import { EventDto } from '@/proxy/intranet/models' import useLocale from '@/utils/hooks/useLocale' import { currentLocalDate } from '@/utils/dateUtils' import { useLocalization } from '@/utils/hooks/useLocalization' const UpcomingEvents: React.FC<{ events: EventDto[] }> = ({ events }) => { const currentLocale = useLocale() const { translate } = useLocalization() const now = dayjs() const upcomingEvents = events .filter((event) => event.isPublished && !dayjs(event.date).isBefore(now, 'day')) .sort((left, right) => dayjs(left.date).valueOf() - dayjs(right.date).valueOf()) return (
{currentLocalDate(event.date, currentLocale || 'tr')} - {event.place}
{translate('::App.Platform.Intranet.Widgets.UpcomingEvents.NoEvent')}
)}