Open
Conversation
commit 095b449 Author: Etshy <garbuio.jonas@gmail.com> Date: Sun Mar 3 02:22:17 2019 +0100 return date to be able chain maxdiff filter with ago filter commit da2f0b1 Author: Etshy <garbuio.jonas@gmail.com> Date: Sun Mar 3 02:08:00 2019 +0100 Fix first argument commit 084be7b Author: Etshy <garbuio.jonas@gmail.com> Date: Sun Mar 3 01:52:15 2019 +0100 Add a maxdiff filter to set a maximum to the "ago" formatting
Author
|
seems like the tests failed because of the I'll change that soon. edit : Didn't remember I used |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #78
Addition of a "maxdiff" filter (I had no idea to name it, if you have a better name, let me know) to limit the Date difference to display the "ago" format.
I made that PR quickly because I wanted to have that behaviour in an app and had no idea how to do that in twig only and i saw a related issue.
It's one of my first PR for an open source project, so if there's any problem with the PR (code or this description), let me know.
Examples:

(in french, sorry. For non-french, It says "5 hours ago")
with the code
{{ chapter.publishedAt|diffmax(15, 'd/m/Y', 'hour')|ago }}(The filters order doesn't seem to matter)(The filter order matter, thediffmaxHAVE TO be prior theagoone)