Created
December 13, 2019 11:06
-
-
Save dimensi/4d3031aeed61becd73d7458b51671e0b to your computer and use it in GitHub Desktop.
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
<script> | |
function r(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1)) + min; //Максимум и минимум включаются | |
} | |
const m = r(7, 10) | |
const y = new Date().getFullYear() + 1 | |
const d = r(1, 28) | |
const o = { year: 'numeric', month: 'long', day: 'numeric' } | |
const p1 = [new Date(y, m, d), new Date(y, m, d + 14)].map(d => d.toLocaleDateString('ru-RU', o)).join(' - ') | |
const m2 = r(2, 6) | |
const d2 = r(1, 28) | |
const p2 = [new Date(y, m2, d2), new Date(y, m2, d2 + 14)].map(d => d.toLocaleDateString('ru-RU', o)).join(' - ') | |
window.onload = () => { document.body.append(p1, document.createElement('br'), p2) } | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment