Faker.fake does not handle date.between

爷,独闯天下 提交于 2020-01-06 05:18:04

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!