From bedbbaa439074ded2fa75fd04ec1279cc4d5496c Mon Sep 17 00:00:00 2001 From: Rhys Mills Date: Thu, 9 Jan 2025 15:13:46 +0000 Subject: [PATCH] If expiry date shows up as a string, convert it to a number before sending to Composer --- public/video-ui/src/util/getComposerData.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/video-ui/src/util/getComposerData.js b/public/video-ui/src/util/getComposerData.js index cd6080c49..cce1ffcf0 100644 --- a/public/video-ui/src/util/getComposerData.js +++ b/public/video-ui/src/util/getComposerData.js @@ -2,12 +2,20 @@ import { parseComposerDataFromImage } from './parseGridMetadata'; import { getStore } from './storeAccessor'; import { impossiblyDistantDate } from '../constants/dates'; import VideoUtils from './video'; +import moment from 'moment'; + +export const getDateAsNumber = (date) => { + if (typeof date === "string"){ + return moment(date).valueOf(); + } + else return date; +}; export function getComposerData(video) { const isTrainingMode = getStore().getState().config.isTrainingMode; - const expiryDate = video.contentChangeDetails && video.contentChangeDetails.expiry && video.contentChangeDetails.expiry.date + const cleanedExpiryDate = getDateAsNumber(expiryDate); const scheduledLaunch = VideoUtils.getScheduledLaunch(video); const embargo = VideoUtils.getEmbargo(video); const isEmbargoedIndefinitely = isTrainingMode || (embargo && embargo >= impossiblyDistantDate); @@ -30,7 +38,7 @@ export function getComposerData(video) { thumbnail: video.trailImage && video.trailImage.assets.length > 0 ? parseComposerDataFromImage(video.trailImage, video.trailText) : null, - expiryDate: expiryDate, + expiryDate: cleanedExpiryDate, scheduledLaunch: scheduledLaunch, requestedScheduledLaunch: scheduledLaunch, embargoedUntil: embargoedUntil,