I want to generate some dates between two fixed values, but I don't know how to
use faker.date.between
to achieve that.
the example in faker js demo is just giving a null
value.
between = function (from, to) { var fromMilli = Date. parse(from); var dateOffset = faker. random. number(Date.
FAQ - What happened to the original faker. js? This project was originally created and hosted at https://github.com/marak/Faker.js/ - however around 4th Jan, 2022 - the author decided to delete the repository (for unknown reasons).
Falso is a modern alternative to Faker. js. Fake data can be useful when building and testing applications. Falso can generate fake data in various areas, including address, commerce, company, date, finance, image, random, and more.
The epic of one of the most beloved open source JS libraries took a quick turn to the dark side. On the 5th of January 2022, a new version of Faker was released by Marak, versioned intentionally 6.6. 6. This marked the unforeseen extinction of the library which was essentially completely deleted from NPM and Github.
Not sure when did they update wiki, but they do have a working sample for date.between
now
faker.date.between('2015-01-01', '2015-01-05');
Their code from Github shows:
self.between = function (from, to) {
var fromMilli = Date.parse(from);
var dateOffset = faker.random.number(Date.parse(to) - fromMilli);
var newDate = new Date(fromMilli + dateOffset);
return newDate;
};
And I don't know how you're using it, or why it's not working on their example.... But this should give you some direction, at least.
If this does not help you, or is still producing an undesired result, I would open an issue up on their github.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With