Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function isEditedPostBeingScheduled( state ) {
const date = getEditedPostAttribute( state, 'date' );
// Offset the date by one minute (network latency)
const checkedDate = new Date( Number( getDate( date ) ) - ONE_MINUTE_IN_MS );
return isInTheFuture( checkedDate );
}
export function isCurrentPostPublished( state, currentPost ) {
const post = currentPost || getCurrentPost( state );
return (
[ 'publish', 'private' ].indexOf( post.status ) !== -1 ||
( post.status === 'future' &&
! isInTheFuture( new Date( Number( getDate( post.date ) ) - ONE_MINUTE_IN_MS ) ) )
);
}