Skip to content

Flaky test for IntlDateFormatter [dateformat_format_relative.phpt] #12618

Closed
@SakiTakamachi

Description

@SakiTakamachi

Description

The test fails at certain times.
https://github.com/php/php-src/actions/runs/6767338868/job/18389812623

The following code:

<?php
$formatter = new IntlDateFormatter(
    "en_US",
    IntlDateFormatter::RELATIVE_FULL,
    IntlDateFormatter::NONE,
    "America/Los_Angeles",
    IntlDateFormatter::GREGORIAN,
);

echo $formatter->format(new DateTimeImmutable("yesterday"));

result:

Saturday, November 4, 2023 // now is 2023-11-06 11:08:00 UTC

This is due to time zone mismatch. I thought it would be enough to just specify the time zone in DateTimeImmutable, but there are places in the test where it is purposely set to UTC, so I don't know what the purpose of the test is.

return new DateTimeImmutable("2020-01-20 20:20:20", new DateTimeZone("UTC"));

Is it okay to just set the time zones?
Regards.

PHP Version

PHP8.1 ~ master

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions