Created
January 2, 2016 21:31
-
-
Save wegorich/faccdf3feff74f8a06bf to your computer and use it in GitHub Desktop.
When we want publish an article in time range, we have to use something like that
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
| var baseDate = new Date(); | |
| function shiftDate(date, minutes){ | |
| date = new Date(date.valueOf() + minutes * 60 * 1000); | |
| if (date.getHours() > 22){ | |
| date.setHours(7); | |
| date.setDate(date.getDate() + 1); | |
| } | |
| return date; | |
| } | |
| setInterval(()=>{ | |
| baseDate = shiftDate(baseDate, 30); | |
| console.log(baseDate); | |
| }, 300); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment