This commit is contained in:
Yax 2019-08-24 09:39:49 +02:00
parent 0964db995e
commit 9b0fb75043
5 changed files with 10 additions and 6 deletions

View file

@ -34,6 +34,8 @@ import glob
import sys
import json
import datetime
import time
from email import utils
from pathlib import Path
import unicodedata
import locale
@ -78,7 +80,9 @@ def read_headers(text):
def rfc_2822_format(date_str):
"""Convert yyyy-mm-dd date string to RFC 2822 format date string."""
d = datetime.datetime.strptime(date_str, '%Y-%m-%d')
return d.strftime('%a, %d %b %Y %H:%M:%S +0000')
dtuple = d.timetuple()
dtimestamp = time.mktime(dtuple)
return utils.formatdate(dtimestamp)
def slugify(value):