问题
I have a template like "{{date.between("2015-01-01", "2015-12-31")}}"
I am passing that to faker.fake function but it is giving Invalid Date
faker.fake("{{date.between("2015-01-01", "2015-12-31")}}") // returns Invalid date
also was trying that faker.fake("{{date.between({"from": "2015-01-01", "to": "2015-12-31"})}}")
but does not work anyway.
Any idea how to fix?
回答1:
It seems faker.js has a logic bug regarding multiple parameters in a template (issue), so indeed you cannot do this. However, this works:
faker.date.between("2015-01-01", "2015-12-31");
来源:https://stackoverflow.com/questions/52828202/faker-fake-does-not-handle-date-between