From 4d9378fb3ce5f913e8bd81b4cdc4bd3a72f4b703 Mon Sep 17 00:00:00 2001 From: pedrobonamin Date: Tue, 17 Sep 2024 14:38:26 +0200 Subject: [PATCH] fix(core): update query to check expiry date --- .../sanity/src/core/studio/studioAnnouncements/query.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/sanity/src/core/studio/studioAnnouncements/query.ts b/packages/sanity/src/core/studio/studioAnnouncements/query.ts index 48c6131f5cec..786fc84b281c 100644 --- a/packages/sanity/src/core/studio/studioAnnouncements/query.ts +++ b/packages/sanity/src/core/studio/studioAnnouncements/query.ts @@ -1,7 +1,12 @@ /** * TODO: Remove once the API call is implemented */ -export const studioAnnouncementQuery = `*[_type == "productAnnouncement"] | order(publishedDate desc) { +export const studioAnnouncementQuery = `*[_type == "productAnnouncement" && + ( + !defined(expiryDate) || + defined(expiryDate) && dateTime(expiryDate) > dateTime(now()) + )] + | order(publishedDate desc) { ..., body[]{ ...,