Skip to content

Commit

Permalink
fix: re-add logic to show announcement based off of start and end dat…
Browse files Browse the repository at this point in the history
…es (#2345)
  • Loading branch information
finnar-bin authored Nov 29, 2023
1 parent 489abfe commit b9e9a0d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/shell/components/InAppAnnouncement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ export const InAppAnnouncement = () => {

const latestAnnouncement = useMemo(() => {
if (announcements?.length) {
return [...announcements].sort((a, b) =>
const latest = [...announcements].sort((a, b) =>
moment(b.created_at).diff(moment(a.created_at))
)?.[0];

if (
moment().isBetween(
moment(latest?.start_date_and_time),
moment(latest?.end_date_and_time)
)
) {
return latest;
}
}
}, [announcements]);

Expand Down

0 comments on commit b9e9a0d

Please sign in to comment.