from datetime import date
from django import template
from django.utils.timesince import timesince, timeuntil
register = template.Library()


@register.filter(name='humanize_date')
def humanize_date(value):
    today = date.today()
    try:
        if value > today:
            return 'In ' + timeuntil(value)
        elif value < today:
            return timesince(value) + ' ago'
        else:
            return 'Today'
    except (ValueError, TypeError):
        return ''

967ca0ee6026d80f0ac87bd8eb2526e605d9cf6f
<mask token>

<mask token>


@register.filter(name='humanize_date')
def humanize_date(value):
    today = date.today()
    try:
        if value > today:
            return 'In ' + timeuntil(value)
        elif value < today:
            return timesince(value) + ' ago'
        else:
            return 'Today'
    except (ValueError, TypeError):
        return ''

<mask token>
register = template.Library()


@register.filter(name='humanize_date')
def humanize_date(value):
    today = date.today()
    try:
        if value > today:
            return 'In ' + timeuntil(value)
        elif value < today:
            return timesince(value) + ' ago'
        else:
            return 'Today'
    except (ValueError, TypeError):
        return ''

from datetime import date
from django import template
from django.utils.timesince import timesince, timeuntil
register = template.Library()


@register.filter(name='humanize_date')
def humanize_date(value):
    today = date.today()
    try:
        if value > today:
            return 'In ' + timeuntil(value)
        elif value < today:
            return timesince(value) + ' ago'
        else:
            return 'Today'
    except (ValueError, TypeError):
        return ''
