We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When passing a unix timestamp, the formatter tries to format it as a string and throw an error:
Uncaught Exception: Failed to parse time string (1671062400) at position 8 (0): Unexpected character in (...)vendor/openpsa/ranger/src/Ranger.php:243
The issue is that prepare_date() first checks if the input is a string (although, technically, an integer is also a string).
I solved it by replacing
if (is_string($input)) { return new Datetime($input); } if (is_int($input)) { $date = new Datetime; $date->setTimestamp($input); return $date; }
with
if (is_numeric($input)) { $date = new Datetime; $date->setTimestamp($input); return $date; } if (is_string($input)) { return new Datetime($input); }
I also replaced is_int() by is_numeric(), which is the recommended way to distinguish a number from a string, is_int() failing in some cases.
The text was updated successfully, but these errors were encountered:
7bd8885
Merge pull request #10 from magicoli/master
3333620
Fix #9 Unix timestamp string not detected
No branches or pull requests
When passing a unix timestamp, the formatter tries to format it as a string and throw an error:
Uncaught Exception: Failed to parse time string (1671062400) at position 8 (0): Unexpected character in (...)vendor/openpsa/ranger/src/Ranger.php:243
The issue is that prepare_date() first checks if the input is a string (although, technically, an integer is also a string).
I solved it by replacing
with
I also replaced is_int() by is_numeric(), which is the recommended way to distinguish a number from a string, is_int() failing in some cases.
The text was updated successfully, but these errors were encountered: