Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faker.date().birthday() returns in invalid Date on Leap Day #1104

Closed
Woermachine opened this issue Feb 29, 2024 · 2 comments
Closed

Faker.date().birthday() returns in invalid Date on Leap Day #1104

Woermachine opened this issue Feb 29, 2024 · 2 comments

Comments

@Woermachine
Copy link

Describe the bug
Faker().date().birthday() is returning the invalid date February 29, 1959.

Theory: Today's day is February 19, 2024 so birthday() must not be account for leap days

Exception Thrown

Invalid date 'February 29' as '1959' is not a leap year
java.time.DateTimeException: Invalid date 'February 29' as '1959' is not a leap year
at java.base/java.time.LocalDate.create(Unknown Source)
at java.base/java.time.LocalDate.of(Unknown Source)
at java.base/java.time.LocalDateTime.of(Unknown Source)
at net.datafaker.providers.base.DateAndTime.birthday(DateAndTime.java:258)
at net.datafaker.providers.base.DateAndTime.birthday(DateAndTime.java:233)

To Reproduce
Call Faker().date().birthday() on February 19, 2024

Expected behavior
Function should return only valid days

Versions:

  • OS: OSX 14.2.1
  • JDK OpenJDK 17.0.7
  • Faker Version 1.8.1

Additional context
Platform: Android

@snuyanzin
Copy link
Collaborator

closing as duplicate #1098
it was fixed almost a half a year ago at #954
please use 2.0.2 or 2.1.0+

please use search before issue creation

@Woermachine
Copy link
Author

Whoops. Thank you @snuyanzin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants