Skip to content

Instantly share code, notes, and snippets.

@poteto
Last active February 18, 2019 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poteto/20f1a19bad7740ec6f47f90b873d2795 to your computer and use it in GitHub Desktop.
Save poteto/20f1a19bad7740ec6f47f90b873d2795 to your computer and use it in GitHub Desktop.
Quick and dirty script to generate some random dates. Copy/paste into your console, it will copy those dates into your clipboard.
const COUNT = 32;
const START_DATE = new Date(2019, 0, 1);
const END_DATE = new Date(2019, 11, 31);
function randomDate(start, end) {
return new Date(
start.getTime() + Math.random() * (end.getTime() - start.getTime())
);
}
copy(
Array.apply(null, { length: COUNT }).map(() =>
randomDate(START_DATE, END_DATE)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment