@@ -108,7 +108,7 @@ export const DayView = () => {
108108 const currentLanguage = i18next . resolvedLanguage || 'en' ;
109109 dayjs . locale ( currentLanguage ) ;
110110
111- const currentDay = dayjs ( startDate ) ;
111+ const currentDay = dayjs . utc ( startDate ) ;
112112
113113 const options = useMemo ( ( ) => {
114114 const createdPosts = posts . map ( ( post ) => ( {
@@ -390,17 +390,16 @@ export const CalendarColumn: FC<{
390390 }
391391 return postList . slice ( 0 , 3 ) ;
392392 } , [ postList , showAll ] ) ;
393- const canBeTrending = useMemo ( ( ) => {
394- return ! ! trendings . find ( ( trend ) => {
395- return dayjs
396- . utc ( trend )
397- . local ( )
398- . isBetween ( getDate , getDate . add ( 10 , 'minute' ) , 'minute' , '[)' ) ;
399- } ) ;
400- } , [ trendings ] ) ;
393+
401394 const isBeforeNow = useMemo ( ( ) => {
402- return getDate . startOf ( 'hour' ) . isBefore ( dayjs ( ) . startOf ( 'hour' ) ) ;
395+ const originalUtc = getDate . startOf ( 'hour' ) ;
396+ console . log (
397+ originalUtc . startOf ( 'hour' ) . format ( ) ,
398+ dayjs ( ) . startOf ( 'hour' ) . utc ( ) . format ( )
399+ ) ;
400+ return originalUtc . startOf ( 'hour' ) . isBefore ( dayjs ( ) . startOf ( 'hour' ) . utc ( ) ) ;
403401 } , [ getDate , num ] ) ;
402+
404403 const { start, stop } = useInterval (
405404 useCallback ( ( ) => {
406405 if ( isBeforeNow ) {
@@ -410,6 +409,7 @@ export const CalendarColumn: FC<{
410409 } , [ isBeforeNow ] ) ,
411410 random ( 120000 , 150000 )
412411 ) ;
412+
413413 useEffect ( ( ) => {
414414 start ( ) ;
415415 return ( ) => {
@@ -459,42 +459,6 @@ export const CalendarColumn: FC<{
459459 } ,
460460 [ ]
461461 ) ;
462- const previewPublication = useCallback (
463- async (
464- postInfo : Post & {
465- integration : Integration ;
466- }
467- ) => {
468- const post = await (
469- await fetch ( `/marketplace/posts/${ postInfo . id } ` )
470- ) . json ( ) ;
471- const integration = await getIntegration ( postInfo ) ;
472- modal . openModal ( {
473- classNames : {
474- modal : 'text-textColor' ,
475- } ,
476- size : 'auto' ,
477- withCloseButton : false ,
478- children : (
479- < IntegrationContext . Provider
480- value = { {
481- allIntegrations : [ ] ,
482- date : dayjs ( ) ,
483- integration,
484- value : [ ] ,
485- } }
486- >
487- < PreviewPopup
488- providerId = { post ?. providerId ! }
489- post = { post }
490- postId = { post . id }
491- />
492- </ IntegrationContext . Provider >
493- ) ,
494- } ) ;
495- } ,
496- [ ]
497- ) ;
498462
499463 const editPost = useCallback (
500464 (
@@ -509,9 +473,7 @@ export const CalendarColumn: FC<{
509473 // @ts -ignore
510474 publishDate : loadPost . actualDate || loadPost . publishDate ,
511475 } ;
512- if ( user ?. orgId === post . submittedForOrganizationId ) {
513- return previewPublication ( post ) ;
514- }
476+
515477 const data = await ( await fetch ( `/posts/${ post . id } ` ) ) . json ( ) ;
516478 const date = ! isDuplicate
517479 ? null
@@ -631,7 +593,12 @@ export const CalendarColumn: FC<{
631593 }
632594 : { } ) }
633595 date = {
634- randomHour ? getDate . hour ( Math . floor ( Math . random ( ) * 24 ) ) : getDate
596+ randomHour
597+ ? getDate . hour ( Math . floor ( Math . random ( ) * 24 ) )
598+ : getDate . format ( 'YYYY-MM-DDTHH:mm:ss' ) ===
599+ dayjs ( ) . startOf ( 'hour' ) . format ( 'YYYY-MM-DDTHH:mm:ss' )
600+ ? dayjs ( ) . add ( 10 , 'minute' )
601+ : getDate
635602 }
636603 { ...( set ?. content ? { set : JSON . parse ( set . content ) } : { } ) }
637604 reopenModal = { ( ) => ( { } ) }
0 commit comments