Conversation
|
I love this too! Pretty short road between implementing this into I think there are good arguments between I'll let @pascalknecht and/or @acobster have a crack at formal review here, but everything I saw looked good! |
acobster
left a comment
There was a problem hiding this comment.
I left a suggestion to use the shorthand ternary operator but I'll leave it up to @gchtr as to whether to update that or not, since this has codebase-wide style implications. Personally I prefer the terser ?: syntax and I'd like to see us gradually transition to that as we go, but this is a minor concern.
Approving for now.
Codecov Report
@@ Coverage Diff @@
## 2.x #2137 +/- ##
============================================
+ Coverage 95.65% 95.67% +0.02%
+ Complexity 1542 1531 -11
============================================
Files 50 50
Lines 3956 3933 -23
============================================
- Hits 3784 3763 -21
+ Misses 172 170 -2
Continue to review full report at Codecov.
|
|
@gchtr hahahaha @ "Elvis operator"! I hadn't heard that term before. Love it. |
|
@acobster When I learnt about it, they called it Elvis operator and I first thought that this was the official name 😆🕺🏻. |
|
Took care of a few merge conflicts, all good now! |
Ticket: #2135
Issue
As of WordPress 5.3, there we a lot of updates to the Date/Time component. Using
date_i18n()is now discouraged and it might be deprecated in the future. Also, there are new helpful functions likeget_post_timestamp()that we can make use of.Solution
date_i18n()and tries to reduces usage ofstrtotime()for posts.$post->timestamp()and$post->modified_timestamp()functions to retrieve a post timestamp as the recommended way.DatedInterface()class to streamline the usage of thetimestamp(),modified_timestamp(),date(),date_modified(),time()andtime_modified()functions. In a later stage, we can use this interface for theTimber\Commentclass.Impact
Breaks backwards compatibility with WordPress version below 5.3. Discussion in #2135.
Usage Changes
New
$post->timestamp()and$post->timestamp_modified()functions.Considerations
DatedInterface, which says that an object has a timestamp, a publishing and a modification date?Testing
Ran test. Fine until now.