Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Query - Date UI/state issue #1535

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/blocks/query/components/DateQueryControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export function DateQueryControl( { id, value, onChange } ) {
'string' === typeof before
? before
: `${ before.month }/${ before.day }/${ before.year } ${ before.hour }:${ before.minute }:${ before.second }`
).toLocaleString();
);
const afterDateTimeStamp = new Date(
'string' === typeof after
? after
: `${ after.month }/${ after.day }/${ after.year } ${ after.hour }:${ after.minute }:${ after.second }`
).toLocaleString();
);

const onBeforeChange = useCallback( function onBeforeChange( newValue ) {
const newDateQuery = {
Expand Down Expand Up @@ -93,8 +93,8 @@ export function DateQueryControl( { id, value, onChange } ) {
const newIncludeAfter = ! includeAfter;
setIncludeAfter( newIncludeAfter );

// If the new value is false, clear the before value.
onBeforeChange( newIncludeAfter ? new Date() : '' );
// If the new value is false, clear the after value.
onAfterChange( newIncludeAfter ? new Date() : '' );
} }
checked={ includeAfter }
/>
Expand Down