from django import template
from django.template.defaultfilters import date

from common.utils.utils import check_container_number_validity

register = template.Library()

@register.filter
def bg_date(value):
    if value:
        return date(value, "y.m.d h:m")
    return ""


@register.simple_tag
def container_validity_class(container_number):
    if not check_container_number_validity(container_number):
        return 'invalid-container'
    return ''

