Task #56200

Clean up duplicated code in calcAge

Added by Tymoteusz Motylewski over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-02-21
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

both classes
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php

implement calcAge() method, which is almost exact copy.
We should refactor it by moving the method to some utility class.


Related issues

Related to TYPO3 Core - Task #20016: wrong age calculating in stdWrap New 2009-02-13
Precedes TYPO3 Core - Task #56651: Move date/time utility methods to own class Closed 2014-03-07

History

#2 Updated by Tymoteusz Motylewski over 5 years ago

Thanks Wouter, I missed this one.
This can be closed then, as it is a duplicate.

#3 Updated by Wouter Wolters over 5 years ago

  • Status changed from New to Closed

#4 Updated by Bernhard Kraft over 5 years ago

  • Status changed from Closed to New

The linked issue is in not really a solution for this problem. I rather addresses wrong age calculation. While this one addressed the code duplication.

I created a patch (review) which fixes the code duplication by also creating a "DateTimeUtility" class.

But no algorithms were changed. Only refactoring.

I guess if the review is merged the other patch changing the behaviour could get implemented easier.

#5 Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28157

#6 Updated by Bernhard Kraft over 5 years ago

  • Status changed from Under Review to New

I posted the patch to gerrit.

Additionally I have a second refactoring patch which moves all date/time related methods from BackendUtility and GeneralUtility to DateTimeUtility

#7 Updated by Gerrit Code Review over 5 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28157

#8 Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28157

#9 Updated by Wouter Wolters almost 5 years ago

  • Status changed from Under Review to Closed

Duplicate of #20016

Also available in: Atom PDF