1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

fix: time zone info is now shown

datetime.now() produces a naive datetime object which does not know tzinfo. 
So the '%z' has no effect. We need to convert it to time zone aware object using
`datetime.astimezone()`.
This commit is contained in:
jdhao 2020-04-17 18:06:48 +08:00 committed by GitHub
parent ec6349fb3f
commit 70f02ae20f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ snippet "meta(data)?" "Markdown front matter in YAML format" br
title: "$1"
date: `!p from datetime import datetime
if not snip.c:
snip.rv=datetime.now().strftime("%Y-%m-%d %H:%M:%S%z")`
snip.rv=datetime.now().astimezone().strftime("%Y-%m-%d %H:%M:%S%z")`
tags: [$2]
categories: [$3]
---