From c5d9085d50f62c768467d303d0905c85b0c59dd8 Mon Sep 17 00:00:00 2001
From: D-Sketon <2055272094@qq.com>
Date: Mon, 22 Jan 2024 14:59:29 +0800
Subject: [PATCH] docs(helper): relative_date and time_tag
---
source/docs/helpers.md | 36 ++++++++++++++++++++++++++++++++++++
source/ru/docs/helpers.md | 36 ++++++++++++++++++++++++++++++++++++
source/zh-cn/docs/helpers.md | 36 ++++++++++++++++++++++++++++++++++++
source/zh-tw/docs/helpers.md | 36 ++++++++++++++++++++++++++++++++++++
4 files changed, 144 insertions(+)
diff --git a/source/docs/helpers.md b/source/docs/helpers.md
index 1b4b6b80e1..8bafe895c5 100644
--- a/source/docs/helpers.md
+++ b/source/docs/helpers.md
@@ -590,6 +590,42 @@ Inserts formatted date and time. `date` can be unix time, ISO string, date objec
// Tuesday, January 1st 2013, 12:00:00 am
```
+### relative_date
+
+Inserts relative time from now. `date` can be unix time, ISO string, date object, or [Moment.js] object.
+
+```js
+<%- relative_date(date) %>
+```
+
+**Examples:**
+
+``` js
+<%- relative_date(new Date()) %>
+// a few seconds ago
+
+<%- relative_date(new Date(1000000000000)) %>
+// 22 years ago
+```
+
+### time_tag
+
+Inserts time tag. `date` can be unix time, ISO string, date object, or [Moment.js] object. `format` is `date_format` setting by default.
+
+```js
+<%- time_tag(date, [format]) %>
+```
+
+**Examples:**
+
+``` js
+<%- time_tag(new Date()) %>
+//
+
+<%- time_tag(new Date(), 'MMM-D-YYYY') %>
+//
+```
+
### moment
[Moment.js] library.
diff --git a/source/ru/docs/helpers.md b/source/ru/docs/helpers.md
index 9fee34b016..51ce3dd9ca 100644
--- a/source/ru/docs/helpers.md
+++ b/source/ru/docs/helpers.md
@@ -496,6 +496,42 @@ Escapes HTML entities in a string.
// Tuesday, January 1st 2013, 12:00:00 am
```
+### relative_date
+
+Inserts relative time from now. `date` can be unix time, ISO string, date object, or [Moment.js] object.
+
+```js
+<%- relative_date(date) %>
+```
+
+**Examples:**
+
+``` js
+<%- relative_date(new Date()) %>
+// a few seconds ago
+
+<%- relative_date(new Date(1000000000000)) %>
+// 22 years ago
+```
+
+### time_tag
+
+Inserts time tag. `date` can be unix time, ISO string, date object, or [Moment.js] object. `format` is `date_format` setting by default.
+
+```js
+<%- time_tag(date, [format]) %>
+```
+
+**Examples:**
+
+``` js
+<%- time_tag(new Date()) %>
+//
+
+<%- time_tag(new Date(), 'MMM-D-YYYY') %>
+//
+```
+
### moment
Библиотека [Moment.js](https://momentjs.com/).
diff --git a/source/zh-cn/docs/helpers.md b/source/zh-cn/docs/helpers.md
index 1e21cc0646..76c81da97d 100644
--- a/source/zh-cn/docs/helpers.md
+++ b/source/zh-cn/docs/helpers.md
@@ -584,6 +584,42 @@ url: https://example.com/blog # example
// Tuesday, January 1st 2013, 12:00:00 am
```
+### relative_date
+
+插入相对当前的时间。`date` 可以是 UNIX 时间、ISO 字符串、Date 对象或 [Moment.js] 对象。
+
+```js
+<%- relative_date(date) %>
+```
+
+**示例:**
+
+``` js
+<%- relative_date(new Date()) %>
+// a few seconds ago
+
+<%- relative_date(new Date(1000000000000)) %>
+// 22 years ago
+```
+
+### time_tag
+
+插入时间标签。`date` 可以是 UNIX 时间、ISO 字符串、Date 对象或 [Moment.js] 对象。`format` 默认为 `date_format` 配置信息。
+
+```js
+<%- time_tag(date, [format]) %>
+```
+
+**示例:**
+
+``` js
+<%- time_tag(new Date()) %>
+//
+
+<%- time_tag(new Date(), 'MMM-D-YYYY') %>
+//
+```
+
### moment
[Moment.js] 函数库。
diff --git a/source/zh-tw/docs/helpers.md b/source/zh-tw/docs/helpers.md
index 0c9af7cbed..581f3a4148 100644
--- a/source/zh-tw/docs/helpers.md
+++ b/source/zh-tw/docs/helpers.md
@@ -486,6 +486,42 @@ Escapes HTML entities in a string.
// Tuesday, January 1st 2013, 12:00:00 am
```
+### relative_date
+
+Inserts relative time from now. `date` can be unix time, ISO string, date object, or [Moment.js] object.
+
+```js
+<%- relative_date(date) %>
+```
+
+**Examples:**
+
+``` js
+<%- relative_date(new Date()) %>
+// a few seconds ago
+
+<%- relative_date(new Date(1000000000000)) %>
+// 22 years ago
+```
+
+### time_tag
+
+Inserts time tag. `date` can be unix time, ISO string, date object, or [Moment.js] object. `format` is `date_format` setting by default.
+
+```js
+<%- time_tag(date, [format]) %>
+```
+
+**Examples:**
+
+``` js
+<%- time_tag(new Date()) %>
+//
+
+<%- time_tag(new Date(), 'MMM-D-YYYY') %>
+//
+```
+
### moment
[Moment.js] 函式庫。