Closed lnfnunes closed 7 years ago
Thanks for bringing this up and proposing a fix. I'll take a look at the changes in detail as soon as I can.
Thanks, your fix works and solves the problem. I would like to merge it but unfortunately it will permanently change the generated values for anyone using a seed. This means I would have to do a major version bump to the semver as it might break people's existing codebases. I would like to wait for a while before doing that, so I'm going to put your fix on-hold for a bit.
FYI the breaking change only occurs in edge cases where the random dates fall on a day boundary. For example, if I try to generate a date between exactly the same two values I end up with two different years:
// Before fix
dummyjson.parse('{{date "1970-01-01" "1970-01-01" "YYYY-MM-DD"}}')
// '1969-12-31'
// After fix
dummyjson.parse('{{date "1970-01-01" "1970-01-01" "YYYY-MM-DD"}}')
// '1970-01-01'
Unfortunately my tests never covered this situation, but I will add them.
Thanks again, I'll make sure this lands in the next major release.
Hum... sorry but I'm not sure if I understood! Are you saying the "Before fix" should be truthy ? Why the date 1 day before the minimun argument? The "After fix" version looks the correct one to me!
The "After fix" version is correct! Your fix works perfectly :)
However, I was demonstrating that it might change the generated output for some people. This means I must update the version of dummy-json to 2.0.0, as per semver. (If people are using dummy-json in their own projects and writing tests against the output then we might break their code.)
I will merge this fix when I am ready to release 2.0.0, but I would like to wait and add some more features before then.
Ok, tks! I'll wait for this version then. This package is amazing and very usefull. Great job ;)
This has now been fixed in version 2.0.0
Hi, I'm from Brazil and the test assserts for 'time' helper was failling due to timezone difference (GMT -3).
Before fix:
After fix: