Jinja environment
Module to store the Jinja environment with custom filters.
date_to_rfc2822(date)
Format date in RFC 2822 format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
date |
datetime |
|
required |
Returns:
Type | Description |
---|---|
str |
String with the date in RFC 2822 format. |
Source code in yaml2rss/service/jinja_environment.py
def date_to_rfc2822(date: datetime) -> str:
"""Format date in RFC 2822 format.
Arguments:
date: `datetime` object.
Returns:
String with the date in RFC 2822 format.
"""
return utils.formatdate(time.mktime(date.timetuple()), usegmt=True)
Last update:
2022-07-27