Generate Date And Time With Chance.js
Anyone knows how to generate a random date and time '03/01/1999 10:30:20' with chance.js. The following only generate date only. chance.date({year: 2019, american: false, string: t
Solution 1:
Chance.js has separate methods to generate time.
You can use chance.hammertime();
for Unix time, chance.hour()
, etc.
Then you can just combine the output in a template string together -
const fakeDateTime = `${date} ${hour}:${minute}:${second}`;
Post a Comment for "Generate Date And Time With Chance.js"