89085[BUGFIX] Respect leap years in timediff age calculation
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Stefan Bürk +1
- Benni Mack +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Stefan Bürk +1
- Benni Mack +1
- core-ci +1 CI
Issues 1
Files 11
- typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php+10 −7
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaRecordTitle.php+5 −5
- typo3/sysext/backend/Classes/Utility/BackendUtility.php7+14 −23
- typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php+19 −6
- typo3/sysext/core/Classes/Localization/DateFormatter.php+44 −0
- typo3/sysext/extensionmanager/Classes/Controller/UpdateFromTerController.php5+7 −4
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php3+10 −25
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php+3 −1
- typo3/sysext/scheduler/Classes/SystemInformation/ToolbarItemProvider.php+8 −5
- typo3/sysext/styleguide/Configuration/TCA/tx_styleguide_elements_basic.php+12 −1
- typo3/sysext/styleguide/ext_tables.sql+1 −0
Review log 3343
Show 1218 earlier messages
-
Benjamin Franzke uploaded patch set 1 04/12/25, 16:15
-
core-ci voted on patch set 1 V -1 04/12/25, 16:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77629
-
Benjamin Franzke uploaded patch set 2
V -104/12/25, 16:56 -
core-ci voted on patch set 2 V +1 04/12/25, 17:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77635
-
Benjamin Franzke uploaded patch set 3
V +104/12/25, 19:23 -
Benjamin Franzke uploaded patch set 4 04/12/25, 19:25
-
Benjamin Franzke updated the commit message in patch set 5 04/12/25, 19:28
-
core-ci voted on patch set 3 V -1 04/12/25, 19:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77642
-
core-ci voted on patch set 4 V -1 04/12/25, 19:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77643
-
core-ci voted on patch set 5 V -1 04/12/25, 19:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77645
-
Benni Mack commented on patch set 5 04/12/25, 19:39
Great (simple) change for such a long-standing issue. A few things: - AbstractFormElement->formatValue() has the same code as TcaRecordTitle -> should be adapted - BackendUtility::dateTimeAge() and BackendUtility::isRecordLocked() should also be adapted. - Scheduler->toolbarItemProvider as well - ExtensionManager/UpdateFromTerController can also benefit from the new formatAge() - Let's hard-require a string in formatAge() I also thought the adapted change was funny :) -
Benjamin Franzke uploaded patch set 6
V -104/12/25, 21:03 -
core-ci voted on patch set 6 V +1 04/12/25, 21:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77652
-
Benni Mack voted on patch set 6 CR +1 V +1 04/12/25, 22:21
-
Oliver Hader commented on patch set 6 04/13/25, 08:06
BackendUtility.php:946That index (and others of `$labelArr`) might not be available since `$labels` is variable... -
Oliver Hader voted on patch set 6 CR +1 04/13/25, 08:09
-
Georg Ringer voted on patch set 6 CR +1 V +1 04/13/25, 20:48
-
Benjamin Franzke commented on patch set 6 04/14/25, 05:32
BackendUtility.php:946ReplyYup, I thought about adding a RuntimeException, when the count after explode does not fit, but that'd fail if we previously "worked" despite an invalid number of units - 1) because the unit wasn't matched or 2) because too many units where supplied. Therefore I didn't want to risk throwing exceptions "just" to be pedantic in a bugfix release. What do you think? Keep as is?
-
Oliver Hader commented on patch set 6 04/14/25, 09:23
BackendUtility.php:946ReplyFine for me... -
Oliver Hader commented on patch set 6 04/14/25, 11:10
UpdateFromTerController.php:77I just tested that... before this patch it was `Time since last update 123 days`, with this patch it's `Time since last update -123 days`. Thus, I guess `$now->diff($lastUpdate)` should be inverted - probably at the other source locations as well. -
Benni Mack commented on patch set 6 V 0 CR -1 04/14/25, 12:57
UpdateFromTerController.php:77ReplyHa, yes. I did not test EM. That's still bug. -
Benni Mack uploaded patch set 7
CR +1V +104/14/25, 13:22 -
Benni Mack commented on patch set 7 CR +1 V +1 04/14/25, 13:22
UpdateFromTerController.php:77ReplyDone -
core-ci voted on patch set 7 V +1 04/14/25, 13:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77700
-
Andreas Kienast voted on patch set 7 CR +1 V +1 04/14/25, 13:40
-
Benjamin Franzke commented on patch set 7 CR -1 04/14/25, 14:15
UpdateFromTerController.php:77Replythanks, kinda ugly, this case basically misused/s the API, by providing positive seconds (which refers to a future timestamp) in order to calculate the label for a past time rendered as a future time (without a leading minus sing). That means the result will not be 100% accurate.. Maybe we'd better add a option to `formatAge` to skip the minus-sign in output, in order to be able to pass-in the correct `DateInterval`. So, although I'd love to just ignore this, I can't.. Will rework... -
Benjamin Franzke uploaded patch set 8
CR +1V +104/14/25, 16:15 -
Benjamin Franzke commented on patch set 8 04/14/25, 16:15
UpdateFromTerController.php:77ReplyDone -
core-ci voted on patch set 8 V +1 04/14/25, 16:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77707
-
Andreas Kienast commented on patch set 8 04/15/25, 05:05
BackendUtility.php:942I wonder whether this patch deserves at least an Important.rst as the requirement for a new flag indicates a change of behavior. -
Oliver Hader commented on patch set 8 V -1 04/15/25, 07:26
ContentObjectRenderer.php:1863After testing, this also does not seem to be correct: TypoScript: ``` page = PAGE page.10 = TEXT page.10.value = 1744701605 page.10.age = " Minuten | Stunden | Tage | Jahre | Minute | Stunde | Tag | Jahr" ``` * without the patch → `3 Minuten` (anything in the range or minutes, hours, days) * with the patch → `55 Jahre` (since the content is added up to the current timestamp - resulting in the difference being the interface since 1970) -
Benjamin Franzke commented on patch set 8 04/15/25, 10:06
BackendUtility.php:942ReplyI don't see a need for any integrator having to act to this change. This flag is only used to apply the fix. Previously the seconds were passed in inverse because age calculation did not take concrete datetime into account, the age calculation was synchronous in either way. Now that it matters if we look 100 days back fix thContentObjectRenderer.php:1863ReplyUgh, thanks! I oversaw that when migrating to using formatAge directly. However, this let's me question the entire change, stdwrap.age is completely broken (inverse) The old code produced a `-` prefix for future dates instead of for past dates... ``` page = PAGE page.10 = TEXT page.10.value = 1744701605 page.10.age = " Minuten | Stunden | Tage | Jahre | Minute | Stunde | Tag | Jahr" page = PAGE page.20 = TEXT # timestamp of tomorrow page.20.value = 1744801605 page.20.age = " Minuten | Stunden | Tage | Jahre | Minute | Stunde | Tag | Jahr" ``` Currently produces ``` 3 Stunden -1 Tag ``` While it should produce: ``` -3 Stunden 1 Tag ``` It is basically non-fixable without being completely breaking.. :( -
Benjamin Franzke commented on patch set 8 04/15/25, 11:18
BackendUtility.php:942Replycomment was incomplete, and in light of https://review.typo3.org/c/Packages/TYPO3.CMS/+/89085/8/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#1863 maybe not even tree anymore, forget about it ;) -
Benjamin Franzke uploaded patch set 9
V +104/15/25, 15:42 -
Benjamin Franzke commented on patch set 9 04/15/25, 15:42
BackendUtility.php:942ReplyRemove this parameter. DateInterval can be created absolute with `DateTime::diff(., true)`, we'll use that if an absolute format is desired.ContentObjectRenderer.php:1863ReplyThanks, fixed by inverting the minus-prefix for calcAge to keep this as before. -
core-ci voted on patch set 9 V -1 04/15/25, 15:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77769
-
Benjamin Franzke uploaded patch set 10
V -104/15/25, 15:51 -
core-ci voted on patch set 10 V +1 04/15/25, 15:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77771
-
Benni Mack voted on patch set 10 CR +1 V +1 04/22/25, 14:19
-
Stefan Bürk voted on patch set 10 CR +1 04/23/25, 10:37
-
Stefan Bürk voted on patch set 10 V +1 04/23/25, 11:58
-
Benjamin Franzke voted on patch set 10 CR +2 V +2 04/24/25, 06:08
-
Benjamin Franzke merged patch set 11 04/24/25, 06:08