8000 [2.3][Form] Removed UTC specification with timestamp by francisbesset · Pull Request #18821 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[2.3][Form] Removed UTC specification with timestamp #18821

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

Merged
merged 1 commit into from
May 30, 2016

Conversation

francisbesset
Copy link
Contributor
@francisbesset francisbesset commented May 20, 2016
Q A
Branch? 2.3
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

The function date_parse() indicates a warning if a timezone is used with the timestamp: Double timezone specification. I removed the UTC specification and this time it's more faster!

@@ -126,7 +126,7 @@ public function reverseTransform($value)

try {
// read timestamp into DateTime object - the formatter delivers in UTC
$dateTime = new \DateTime(sprintf('@%s UTC', $timestamp));
$dateTime = new \DateTime(sprintf('@%s', $timestamp), new \DateTimeZone('UTC'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it better? any benefit?

Copy link
Contributor Author
@francisbesset francisbesset May 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas After bench, the usage of a DateTimeZone is slower 👎

But the function date_parse() indicates a warning if a timezone is used with the timestamp: Double timezone specification. I removed the UTC specification and this time it's more faster! 👍

Source:
strip-le-pm-et-le-tsu-650-finalenglish-2

@francisbesset francisbesset changed the title [Form] Used second arg of DateTime to specify timezone [Form] Removed UTC specification with timestamp May 24, 2016
@francisbesset francisbesset changed the title [Form] Removed UTC specification with timestamp [2.3][Form] Removed UTC specification with timestamp May 24, 2016
@nicolas-grekas
Copy link
Member

👍

@nicolas-grekas
Copy link
Member

Thank you @francisbesset.

@nicolas-grekas nicolas-grekas merged commit 0d14aac into symfony:2.3 May 30, 2016
nicolas-grekas added a commit that referenced this pull request May 30, 2016
…cisbesset)

This PR was merged into the 2.3 branch.

Discussion
----------

[2.3][Form] Removed UTC specification with timestamp

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

The function `date_parse()` indicates a warning if a timezone is used with the timestamp: `Double timezone specification`. I removed the UTC specification and this time it's more faster!

Commits
-------

0d14aac Removed UTC specification with timestamp
@fabpot fabpot mentioned this pull request May 30, 2016
This was referenced Jun 6, 2016
@fabpot fabpot mentioned this pull request Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0