Skip to content

Commit

Permalink
🚩 Updated Published date preview for news(#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavi25 committed Aug 9, 2022
1 parent 347ba9a commit 2d95ec5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions studio/schemas/documents/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
relatedLinks,
excludeFromSearch,
} from './news/sharedNewsFields'
import { HAS_NEWS, HAS_NEWS_SUBSCRIPTION,IS_TEST } from '../../src/lib/datasetHelpers'
import { HAS_NEWS, HAS_NEWS_SUBSCRIPTION, IS_TEST } from '../../src/lib/datasetHelpers'
import { SearchWeights } from '../searchWeights'
import { withSlugValidation } from '../validations/validateSlug'

Expand Down Expand Up @@ -113,16 +113,17 @@ export default {
},
prepare(selection) {
const { title, media, description, publishedDate, firstPublishedAt, isCustomDate } = selection
const date =
IS_TEST && publishedDate && isCustomDate
const date = publishedDate ? formatDate(publishedDate) : 'Ikke oppgitt'
const date_new =
publishedDate && isCustomDate
? formatDate(publishedDate)
: firstPublishedAt
? formatDate(firstPublishedAt)
: 'Ikke oppgitt'
const ingressBlock = (description || []).find((ingressBlock) => ingressBlock._type === 'block')
return {
title,
subtitle: `Published date: ${date}`,
subtitle: `Published date: ${IS_TEST && date_new ? date_new : date}`,
description: ingressBlock
? ingressBlock.children
.filter((child) => child._type === 'span')
Expand Down

0 comments on commit 2d95ec5

Please sign in to comment.