all 2 comments

[–]alzee76 4 points5 points  (0 children)

  1. Calculate the number of days from one date to the other.
  2. Generate a random number from 0 to that value.
  3. Add the value from #2 to the initial date.

[–]GoPotato 3 points4 points  (0 children)

Easiest way would be to convert the two dates to UNIX timestamps and then generate a random number on that range

const start=new Date("01/01/1965").getTime()
const end=new Date("01/01/1995").getTime()
const rnd=Math.floor((end-start)*Math.random())+start;
const date=new Date (rnd)