java-faker
java-faker copied to clipboard
Generate Java Time Random Date
Is your feature request related to a problem? Please describe. With a java 8+ project we must convert Date to LocalDate, LocalDateTime, ...
Describe the solution you'd like The faker should return java time object instead of java Date.
LocalDate date = faker.localDate().past(1, TimeUnit.DAYS);
Describe alternatives you've considered The actual code is :
LocalDate date = faker.date().past(1, TimeUnit.DAYS).toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
Additional context The lib must change to be build with java 8 SDK (the java 6 support is end since december 2018)
Maybe using java.time.temporal.ChronoUnit
would be a better fit. It would at least offer more possibilities, but the added complexity might be a non-starter.
faker.localDate().past(6, ChronoUnit.MONTHS);
Our group are interested in this issue, we will try to fix it. ---- SE_Sustech
I'd like to pull request for this issue.
#624
Is this issue resolved?