Created
February 10, 2019 15:44
-
-
Save httpstersk/77369b6ea93d99ea5c8c4d694a2ed166 to your computer and use it in GitHub Desktop.
➋➍ Schedule a post for tomorrow (24 hours from now)
This file contains 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
const { dispatch } = wp.data; | |
const { editPost } = dispatch( 'core/editor' ); | |
const NOW = new Date(); | |
const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000; | |
const TOMORROW = new Date( NOW.getTime() + ONE_DAY_IN_MS ); | |
const schedulePost = date => editPost( { date } ); | |
schedulePost( TOMORROW ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment