Skip to content

Instantly share code, notes, and snippets.

@nikolay-kapustin
Last active December 13, 2019 11:03
Show Gist options
  • Save nikolay-kapustin/5dd00626a5c1dab349224cec1b266cc1 to your computer and use it in GitHub Desktop.
Save nikolay-kapustin/5dd00626a5c1dab349224cec1b266cc1 to your computer and use it in GitHub Desktop.
Vacations dates generator
<script>function%20r(e,t){return%20e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}const%20m=r(7,10),nextY=(new%20Date).getFullYear()+1,d=r(1,28),options={year:"numeric",month:"long",day:"numeric"},firstPeriod=[new%20Date(nextY,m,d),new%20Date(nextY,m,d+14)].map(e=>e.toLocaleDateString("ru-RU",options)).join("%20-%20"),m2=r(2,6),d2=r(1,28),secondPeriod=[new%20Date(nextY,m2,d2),new%20Date(nextY,m2,d2+14)].map(e=>e.toLocaleDateString("ru-RU",options)).join("%20-%20");document.writeln(`${firstPeriod}<br>${secondPeriod}`);</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment