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

Allow for timestamps before the epoch #271

Merged
merged 2 commits into from
Jun 19, 2023
Merged

Allow for timestamps before the epoch #271

merged 2 commits into from
Jun 19, 2023

Conversation

markhuot
Copy link
Contributor

@markhuot markhuot commented Nov 29, 2022

I'm not sure this is the right fix but timestamps can technically be negative numbers. I have some dates that I'm importing that range back to 1920 and am currently getting an error that Value {source_value} does not match any of 'non-empty-string', 'positive-int' for the value -450734400.

If you agree with this change I can expand the PR, update the tests, etc.

@romm
Copy link
Member

romm commented Nov 30, 2022

Hi @markhuot, thank you for the suggestion; I didn't know about this usage of the timestamp.

It makes sense to me: please add tests to the PR, and I will be happy to merge it. 🙂

@@ -44,7 +44,7 @@ public function __construct(string $format, string ...$formats)

/**
* @param class-string<DateTime|DateTimeImmutable> $className
* @param non-empty-string|positive-int $value
* @param non-empty-string $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param non-empty-string $value
* @param non-empty-string|int $value

@romm romm merged commit d358e83 into CuyZ:master Jun 19, 2023
11 checks passed
@romm
Copy link
Member

romm commented Jun 19, 2023

Thank you guys!

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

Successfully merging this pull request may close these issues.

3 participants