Skip to content

IntlDateFormatter::localtime broken example #4636

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

Open
nielsdos opened this issue Apr 26, 2025 · 2 comments
Open

IntlDateFormatter::localtime broken example #4636

nielsdos opened this issue Apr 26, 2025 · 2 comments
Labels
bug Documentation contains incorrect information

Comments

@nielsdos
Copy link
Member

Affected page

https://www.php.net/manual/en/intldateformatter.localtime.php

Issue description

Run the example code, you'll get an error. This makes sense because the $offset is passed as an integer but you can't because the argument is a reference.

Steps to reproduce

Run the examples.

Suggested fix

Probably introduce a variable $offset, set it to 0, and pass that.

@nielsdos nielsdos added the bug Documentation contains incorrect information label Apr 26, 2025
@nielsdos nielsdos self-assigned this Apr 26, 2025
@nielsdos nielsdos changed the title IntlDateFormatter:localtime broken example IntlDateFormatter::localtime broken example Apr 26, 2025
@nielsdos nielsdos removed their assignment Apr 26, 2025
@nielsdos
Copy link
Member Author

Actually, even after doing the proposed fix the output is just empty, not the output listed in the manual. cc @devnexen

@leonardolara
Copy link
Contributor

leonardolara commented Apr 27, 2025

It happens that the format should be
'Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time'

This can be checked with
echo datefmt_format( $fmt , 0);

Also, the output should be changed to:
First parsed output is tm_sec : 0 , tm_min : 0 , tm_hour : 16 , tm_year : 69 , tm_mday : 31 , tm_wday : 3 , tm_yday : 365 , tm_mon : 11 , tm_isdst : 0 ,

leonardolara added a commit to leonardolara/doc-en that referenced this issue Apr 27, 2025
Date/time format adjusted to match the specified one in the first line.
Last parameter is a reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Documentation contains incorrect information
Projects
None yet
Development

No branches or pull requests

2 participants