def METHOD_NAME(date, format=None):
    """
    Jinja2 filter for moment.js compatible dates.
    :param date:
    :param format:
    :return: str
    """
    settings = get_resource_service('themes').get_default_settings(theme)
    locale = settings.get('language', 'en')
    parsed = arrow.get(date)
    if not format:
        format = settings.get('datetimeFormat', DEFAULT_THEME_DATE_FORMAT)
    # Workaround for "x" unsupported format
    if format == 'x':
        return parsed.timestamp
    # TODO: implement momentjs `Localized formats`
    elif re.search('l+', format.lower()):
        format = DEFAULT_THEME_DATE_FORMAT
    if format == 'ago':
        formated = parsed.humanize()
    else:
        formated = parsed.to(DEFAULT_THEME_TIMEZONE).format(DEFAULT_THEME_DATE_FORMAT)
    try:
        if format == 'ago':
            formated = parsed.humanize(locale=locale)
        else:
            formated = parsed.to(DEFAULT_THEME_TIMEZONE).format(format, locale=locale)
    except Exception:
        logger.info("language not supported")
    return formated