diff options
author | Bruno Wagner <bwagner@riseup.net> | 2015-09-24 17:58:16 -0300 |
---|---|---|
committer | Bruno Wagner <bwagner@riseup.net> | 2015-09-25 16:54:36 -0300 |
commit | d186b0204f738367d530514707d0f95a6d4bf865 (patch) | |
tree | 276f5254aed59efdf5ce3cfc70be43ac448f2189 /service/pixelated/support | |
parent | 6eba069fdb566fd006fa48b8b9c5d5b44085f524 (diff) |
Changed date format to conform to mail RFC #438
Diffstat (limited to 'service/pixelated/support')
-rw-r--r-- | service/pixelated/support/date.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/service/pixelated/support/date.py b/service/pixelated/support/date.py index e7cdbb30..0012aeea 100644 --- a/service/pixelated/support/date.py +++ b/service/pixelated/support/date.py @@ -16,6 +16,7 @@ import datetime import dateutil.parser +from email.utils import formatdate from dateutil.tz import tzlocal @@ -23,9 +24,6 @@ def iso_now(): return datetime.datetime.now(tzlocal()).isoformat() -def milliseconds(date): - date = dateutil.parser.parse(date) - date = date.replace(tzinfo=None) - epoch = datetime.datetime.utcfromtimestamp(0) - delta = date - epoch - return int(delta.total_seconds() * 1000) +def mail_date_now(): + date = dateutil.parser.parse(iso_now()) + return formatdate(float(date.strftime('%s'))) |