-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Editor: Incorrect save button label when toggling dates to schedule a post #60281
Comments
As also mentioned in the initial comment, this could be related to #3036. |
In the publish-date-time-picker component, there is an issue where clicking the "Now" button returns null, which creates an inconsistency with the DatePickerComponent. This causes the datepicker to incorrectly set dates in GMT format. <InspectorPopoverHeader
title={ __( 'Publish' ) }
actions={
showPopoverHeaderActions
? [
{
label: __( 'Now' ),
onClick: () => onChange?.( null ),
},
]
: undefined
}
onClose={ onClose }
/> The proposed fix addresses this by passing the current datetime instead: const handleNowClick = () => {
// Both TimePicker and DateTimePicker expect full ISO datetime string without timezone
const now = new Date().toISOString().slice(0, 19);
onChange?.(now);
}; This solution resolves the intermittent datetime parsing issues that were occurring when the datepicker processed updates. I will be opening up a PR for review |
I don't have a deep understanding of the background of this issue, but I have one concern if we adopt this approach. For example:
In this case, the writer would expect the article to be published at 9:30. But won't the actual publish date be the time the Now button was pressed, i.e. 9:00? If so, this doesn't seem to be the expected behavior. |
That does seem to be an issue. I agree that it should set the date-time to match the actual time of publishing. I'll explore alternative solutions to address this properly. Thanks for pointing it out! |
I noticed a strange behavior of the "Now" button. It resets the time to my machine's time instead of the timezone set by WP, which can lead to strange scheduling behavior.
Example:
I'm not 100% sure what the intended behavior should be here, but initially, I thought it was a bug caused by the update and had to re-test it on the trunk.
Screencast
CleanShot.2024-03-28.at.12.35.54.mp4
Originally posted by @Mamaduka in #60163 (review)
The text was updated successfully, but these errors were encountered: