Remove moment from the public API of the date module#11418
Merged
youknowriad merged 2 commits intomasterfrom Nov 6, 2018
Merged
Remove moment from the public API of the date module#11418youknowriad merged 2 commits intomasterfrom
youknowriad merged 2 commits intomasterfrom
Conversation
tofumatt
approved these changes
Nov 2, 2018
Member
tofumatt
left a comment
There was a problem hiding this comment.
Looks good to me; mostly curious about "sdays" and have some minor tweak suggestions.
|
|
||
| describe( 'isEditedPostBeingScheduled', () => { | ||
| it( 'should return true for posts with a future date', () => { | ||
| const time = Date.now() + ( 1000 * 3600 * 24 * 7 ); // sdays in the future |
Contributor
Author
There was a problem hiding this comment.
It means "7 days", it's a new language invented by my broken keyboard :)
aduth
previously requested changes
Nov 2, 2018
aduth
reviewed
Nov 2, 2018
|
|
||
| return [ 'publish', 'private' ].indexOf( post.status ) !== -1 || | ||
| ( post.status === 'future' && moment( post.date ).isBefore( moment() ) ); | ||
| ( post.status === 'future' && ! isInTheFuture( post.date, 1 ) ); |
Member
There was a problem hiding this comment.
Will a future maintainer understand what the second argument it is by glancing at it? It confuses me just now looking at it.
Member
There was a problem hiding this comment.
Can we prepare this ahead of time? If it's an ISO-8601 string, could we just do new Date( Number( new Date( post.date ) ) + MINUTE_IN_MS )
8e9b7f3 to
03102d4
Compare
This was referenced Nov 6, 2018
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm doing so by adding a new function in the data module
isInTheFutureto check whether a given WP date is considered in the future or not.Testing instructions