better timezone handling for new posts
This commit is contained in:
parent
3009012319
commit
0739e2e11a
@ -45,6 +45,7 @@
|
||||
- ipython[notebook]==2.4.1
|
||||
- beautifulsoup4
|
||||
- cookiecutter
|
||||
- tzlocal
|
||||
sudo: yes
|
||||
|
||||
- name: clone pelican-plugins
|
||||
|
@ -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')})
|
||||
|
Loading…
Reference in New Issue
Block a user