Skip to content

Fix the isBeingScheduled Selector. #11572

Merged
youknowriad merged 4 commits intomasterfrom
fix/is-in-the-future-function
Nov 7, 2018
Merged

Fix the isBeingScheduled Selector. #11572
youknowriad merged 4 commits intomasterfrom
fix/is-in-the-future-function

Conversation

@youknowriad
Copy link
Copy Markdown
Contributor

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 a getDate 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)

@youknowriad youknowriad added [Type] Bug An existing feature does not function as intended [Package] Date /packages/date labels Nov 7, 2018
@youknowriad youknowriad self-assigned this Nov 7, 2018
@youknowriad youknowriad requested review from a team and tofumatt November 7, 2018 10:11
@youknowriad youknowriad added this to the 4.3 milestone Nov 7, 2018
Copy link
Copy Markdown
Member

@tofumatt tofumatt left a 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! 👍

Comment thread packages/date/src/index.js Outdated
}

/**
* Given a string containing a date object formatted using the WP timezone
Copy link
Copy Markdown
Member

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 😄

Comment thread packages/date/src/test/index.js Outdated
Co-Authored-By: youknowriad <benguella@gmail.com>
@youknowriad youknowriad force-pushed the fix/is-in-the-future-function branch from 4648009 to 4dcc13f Compare November 7, 2018 14:04
@youknowriad youknowriad merged commit 1ac70e1 into master Nov 7, 2018
@youknowriad youknowriad deleted the fix/is-in-the-future-function branch November 7, 2018 15:55
daniloercoli added a commit that referenced this pull request Nov 7, 2018
…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)
* 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.
Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Date /packages/date [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Post set to publish immediately shows a "Schedule" button instead of "Publish" button

3 participants