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

DateTimeImmutable objects cannot be used as arguments for DateTime faker functions like e.g. dateTimeBetween #947

Open
AndreasA opened this issue Feb 12, 2025 · 0 comments

Comments

@AndreasA
Copy link

Summary

DateTime generators do not support passing a DateTimeImmutable object.

I know about the issue #512

However, I also noticed that one cannot pass a DateTimeImmutable object to e.g. dateTimeBetween.

This should be quite an easy fix without breaking changes.

It should be enough to change https://github.com/FakerPHP/Faker/blob/v1.24.1/src/Faker/Core/DateTime.php#L39 to check for DateTimeInterface and the rest should work as it is.

Same still applies to the 2.0 branch.

Versions

Version
PHP 8.4
fakerphp/faker 1.24.1
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

1 participant