Skip to content

Commit

Permalink
Do not close popover after publish date is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 18, 2022
1 parent af33e68 commit 3f24700
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions packages/editor/src/components/post-schedule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { __experimentalGetSettings } from '@wordpress/date';
import { useDispatch, useSelect } from '@wordpress/data';
import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
import { useRef, useState, useMemo } from '@wordpress/element';
import { useState, useMemo } from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';

/**
Expand Down Expand Up @@ -61,7 +61,6 @@ export default function PostSchedule( { onClose } ) {
[ eventsByPostType ]
);

const ref = useRef();
const settings = __experimentalGetSettings();

// To know if the current timezone is a 12 hour time with look for "a" in the time format
Expand All @@ -75,17 +74,10 @@ export default function PostSchedule( { onClose } ) {
.join( '' ) // Reverse the string and test for "a" not followed by a slash.
);

function onChange( newDate ) {
onUpdateDate( newDate );
const { ownerDocument } = ref.current;
ownerDocument.activeElement.blur();
}

return (
<PublishDateTimePicker
ref={ ref }
currentDate={ postDate }
onChange={ onChange }
onChange={ onUpdateDate }
is12Hour={ is12HourTime }
events={ events }
onMonthPreviewed={ setPreviewedMonth }
Expand Down

0 comments on commit 3f24700

Please sign in to comment.