Skip to content

Conversation

@maxhelias
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

This syntax raises a php exception :

(new \DateTime($log['timestamp']))->format('H:i:s');
<br />
<b>Fatal error</b>:  Uncaught Exception: DateTime::__construct(): Failed to parse time string (1565179387) at position 7 (3): Unexpected character in [...][...]:4
Stack trace:
#0 [...][...](4): DateTime-&gt;__construct('1565179387')
#1 {main}
  thrown in <b>[...][...]</b> on line <b>4</b><br />

<td class="text-small" nowrap>
<span class="colored text-bold"><?= $this->escape($log['priorityName']); ?></span>
<span class="text-muted newline"><?= (new \DateTime($log['timestamp']))->format('H:i:s'); ?></span>
<span class="text-muted newline"><?= (new \DateTime())->setTimestamp($log['timestamp'])->format('H:i:s'); ?></span>
Copy link
Member

Choose a reason for hiding this comment

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

for short date('H:i:s', $log['timestamp'])?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's more readable 😃

@yceruto
Copy link
Member

yceruto commented Aug 7, 2019

Thank you @maxhelias.

@yceruto yceruto merged commit a0ad2d0 into symfony:4.4 Aug 7, 2019
yceruto added a commit that referenced this pull request Aug 7, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorRenderer] Fix timestamp on logs view

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This syntax raises a php exception :
```php
(new \DateTime($log['timestamp']))->format('H:i:s');
```

```
<br />
<b>Fatal error</b>:  Uncaught Exception: DateTime::__construct(): Failed to parse time string (1565179387) at position 7 (3): Unexpected character in [...][...]:4
Stack trace:
#0 [...][...](4): DateTime-&gt;__construct('1565179387')
#1 {main}
  thrown in <b>[...][...]</b> on line <b>4</b><br />
```

Commits
-------

a0ad2d0 [ErrorRenderer] Fix timestamp on logs view
@maxhelias maxhelias deleted the fix-log-datetime branch August 7, 2019 13:33
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
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.

6 participants