better timezone handling for new posts

This commit is contained in:
Marvin Steadfast 2015-09-15 11:47:21 +02:00
parent 3009012319
commit 0739e2e11a
2 changed files with 5 additions and 1 deletions

View File

@ -45,6 +45,7 @@
- ipython[notebook]==2.4.1
- beautifulsoup4
- cookiecutter
- tzlocal
sudo: yes
- name: clone pelican-plugins

View File

@ -1,7 +1,10 @@
from cookiecutter.main import cookiecutter
from datetime import datetime
from tzlocal import get_localzone
import pytz
cookiecutter(
'cookiecutter-new-post',
extra_context={'date': datetime.utcnow().strftime('%Y-%m-%d %H:%M')})
extra_context={
'date': datetime.utcnow().replace(tzinfo=pytz.utc).astimezone(get_localzone()).strftime('%Y-%m-%d %H:%M')})