Skip to content

Commit

Permalink
modify current_time to generate random datetime (#53)
Browse files Browse the repository at this point in the history
this is to simulate random, historical events
  • Loading branch information
nikhilsinhaparseable authored Mar 7, 2024
1 parent cec30b9 commit b8fcb5b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/load_batch_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ export const options = {
};

function current_time() {
let event = new Date();
return event.toISOString();
const startDate = new Date('2022-01-01');
const endDate = new Date('2022-01-31');
const timeDiff = endDate.getTime() - startDate.getTime();
const randomTime = Math.random() * timeDiff;
const randomDate = new Date(startDate.getTime() + randomTime);
return(randomDate.toISOString());
}

function schemas() {
Expand Down

0 comments on commit b8fcb5b

Please sign in to comment.