Creating a template filter to show how much time has passed since a post was published

Not all people keep track of the date, and it can be easy to miscalculate it when trying to determine the difference between dates in your head. When talking about creation or modification dates, it is convenient to read a more human-readable time difference. For example, the blog entry was posted 3 days ago, the news article was published today, and the user last logged in yesterday. In this recipe, we will create a template filter named date_since, which converts dates to humanized time differences based on days, weeks, months, or years.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.143.239