php / php/php-src

`MessageFormatter` uses default timezone to format dates

Open
#10,956 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: intl Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php

date_default_timezone_set('UTC');

echo MessageFormatter::formatMessage(
    'fr_FR',
    '{datetime, time, short}',
    ['datetime' => new DateTimeImmutable('2023-03-27T12:00', new DateTimeZone('Europe/Paris'))]
);

Resulted in this output:

10:00

But I expected this output instead:

12:00
PHP Version

all

Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided PHP snippet and tracing the MessageFormatter date/time formatting path. Done means the DateTimeImmutable timezone is respected, producing 12:00 for the example, with regression coverage for the reported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
internationalization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.