diff --git a/ansible/vagrant.yml b/ansible/vagrant.yml index ce3b4af..5e64714 100644 --- a/ansible/vagrant.yml +++ b/ansible/vagrant.yml @@ -45,6 +45,7 @@ - ipython[notebook]==2.4.1 - beautifulsoup4 - cookiecutter + - tzlocal sudo: yes - name: clone pelican-plugins diff --git a/newpost.py b/newpost.py index a348a5f..13b43f2 100644 --- a/newpost.py +++ b/newpost.py @@ -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')})