-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix the isBeingScheduled Selector. #11572
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good; I think it's worth tweaking the comments a bit as mentioned but it fixes the bug for me! 👍
packages/date/src/index.js
Outdated
@@ -406,4 +406,20 @@ export function isInTheFuture( dateValue ) { | |||
return momentObject.isAfter( now ); | |||
} | |||
|
|||
/** | |||
* Given a string containing a date object formatted using the WP timezone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This documentation is worded a bit oddly; I'll attempt a little rewrite 😄
Co-Authored-By: youknowriad <[email protected]>
4648009
to
4dcc13f
Compare
…rnmobile/fix-merge-content-not-refreshed-UI * 'master' of https://github.com/WordPress/gutenberg: Fix the isBeingScheduled Selector. (#11572) Slot/Fill pattern with Toolbar #199 (#11115) Add mechanism to avoid forced child selection on blocks with templates. (#10696) Allow a block to disable being converted into a reusable block; Fix: Column block (#11550)
@@ -395,7 +395,7 @@ export function dateI18n( dateFormat, dateValue = new Date(), gmt = false ) { | |||
/** | |||
* Check whether a date is considered in the future according to the WordPress settings. | |||
* | |||
* @param {(Date|string)} dateValue Date object or string. | |||
* @param {string} dateValue Date String or Date object in the Defined WP Timezone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is it a string or an object? The current documentation here sends mixed messaging.
closes #11554
Dealing with timezones in JavaScript while the timezone is defined in the server is hard in WordPress. Hopefully, I added some tests to the date module to avoid breakage.
This fixes two issues:
Doing
new Date( wpDateString )
is wrong because it will read the date as if it was in the browser's timezone which is wrong. I added agetDate
function to the date module to apply the WP timezone instead.A small bug introduced in Remove moment from the public API of the date module #11418 (where instead of removing a minute offset, we were adding a minute)