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

[intl] IntlDateFormatter::format polyfill does not support \DateTimeInterface #32898

Closed
Tobion opened this issue Aug 3, 2019 · 0 comments
Closed

Comments

@Tobion
Copy link
Member

Tobion commented Aug 3, 2019

IntlDateFormatter::format supports DateTimeInterface since php 7.1.5, see https://www.php.net/manual/en/intldateformatter.format.php

7.1.5 | Support for providing general DateTimeInterface objects to the value parameter was added. Formerly, only properDateTime objects were supported.

But symfony/intl polyfill does not, see

if (!\is_int($timestamp) && !$timestamp instanceof \DateTime) {
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
}

nicolas-grekas added a commit that referenced this issue Aug 5, 2019
…mat (pierredup)

This PR was merged into the 3.4 branch.

Discussion
----------

[Intl] Support DateTimeInterface in IntlDateFormatter::format

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32898
| License       | MIT
| Doc PR        | N/A

Add support for `DateTimeInterface` to `IntlDateFormatter::format` which is supported since PHP 7.1.5.

Since this component supports PHP from 7.1.3, should version checks be added, to only support DateTimeInterface if PHP is >= 7.1.5 or should the minimum required PHP version bumped to 7.1.5?

Commits
-------

b1e160c Support DateTimeInterface in IntlDateFormatter::format
@xabbuh xabbuh closed this as completed Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants