refactor(locale): restore options for changing date format (#716)

This commit is contained in:
Cotes Chung 2022-10-19 02:49:31 +08:00
parent 81b9f7a9ac
commit f904e8cd48
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
5 changed files with 28 additions and 15 deletions

View File

@ -73,6 +73,16 @@ post:
# pinned prompt of posts list on homepage # pinned prompt of posts list on homepage
pin_prompt: Pinned pin_prompt: Pinned
# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: '%b %e, %Y'
dayjs: 'll'
archives:
strftime: '%b'
dayjs: 'MMM'
# categories page # categories page
categories: categories:
category_measure: category_measure:

View File

@ -73,6 +73,13 @@ post:
# pinned prompt of posts list on homepage # pinned prompt of posts list on homepage
pin_prompt: pin_prompt:
# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: '%Y/%m/%d'
dayjs: 'YYYY/MM/DD'
# categories page # categories page
categories: categories:
category_measure: 카테고리 category_measure: 카테고리

View File

@ -72,6 +72,13 @@ post:
# pinned prompt of posts list on homepage # pinned prompt of posts list on homepage
pin_prompt: 顶置 pin_prompt: 顶置
# Date time format.
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
df:
post:
strftime: '%Y/%m/%d'
dayjs: 'YYYY/MM/DD'
# categories page # categories page
categories: categories:
category_measure: 个分类 category_measure: 个分类

View File

@ -4,14 +4,8 @@
--> -->
{% assign wrap_elem = include.wrap | default: 'em' %} {% assign wrap_elem = include.wrap | default: 'em' %}
{% assign df_strftime = site.data.locales[lang].df.post.strftime | default: '%d/%m/%Y' %}
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %} {% assign df_dayjs = site.data.locales[lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
{% assign df_strftime = '%b %e, %Y' %}
{% assign df_dayjs = 'll' %}
{% else %}
{% assign df_strftime = '%F' %}
{% assign df_dayjs = 'YYYY-MM-DD' %}
{% endif %}
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}" <{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
data-ts="{{ include.date | date: '%s' }}" data-ts="{{ include.date | date: '%s' }}"

View File

@ -5,13 +5,8 @@ layout: page
{% include lang.html %} {% include lang.html %}
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %} {% assign df_strftime_m = site.data.locales[lang].df.archives.strftime | default: '/ %m' %}
{% assign df_strftime_m = '%b' %} {% assign df_dayjs_m = site.data.locales[lang].df.archives.dayjs | default: '/ MM' %}
{% assign df_dayjs_m = 'MMM' %}
{% else %}
{% assign df_strftime_m = '/ %m' %}
{% assign df_dayjs_m = '/ MM' %}
{% endif %}
<div id="archives" class="pl-xl-3"> <div id="archives" class="pl-xl-3">