express-sweet 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/build.common.js +14 -12
- package/dist/build.esm.js +14 -12
- package/docs/index.html +33 -1
- package/package.json +1 -1
- package/types/handlebars_helpers/date.d.ts +10 -17
- package/types/handlebars_helpers/index.d.ts +2 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/isArray.d.ts +8 -0
- package/types/utils/isString.d.ts +1 -1
package/docs/index.html
CHANGED
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
<a class="nav-link" href="#views-html-helpers">HTML helpers</a>
|
|
66
66
|
<a class="nav-link" href="#views-object-helpers">Object helpers</a>
|
|
67
67
|
<a class="nav-link" href="#views-string-helpers">String helpers</a>
|
|
68
|
+
<a class="nav-link" href="#views-date-helpers">Date helpers</a>
|
|
68
69
|
</nav>
|
|
69
70
|
<a class="nav-link" href="#model">Model</a>
|
|
70
71
|
<nav class="nav nav-pills flex-column flex-nowrap fw-normal small">
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
</div>
|
|
112
113
|
<hr class="mx-auto mx-lg-0 my-5">
|
|
113
114
|
<p class="text-muted">
|
|
114
|
-
Currently <a href="https://github.com/takuya-motoshima/express-sweet/releases/tag/v1.0.
|
|
115
|
+
Currently <a href="https://github.com/takuya-motoshima/express-sweet/releases/tag/v1.0.19" target="_blank">v1.0.19</a>
|
|
115
116
|
<span class="px-1">•</span>
|
|
116
117
|
<a href="#quick-start">Quick Start</a>
|
|
117
118
|
<span class="px-1">•</span>
|
|
@@ -1303,6 +1304,37 @@ let val = '2'
|
|
|
1303
1304
|
</tr>
|
|
1304
1305
|
</tbody>
|
|
1305
1306
|
</table>
|
|
1307
|
+
<h2 id="views-date-helpers">Date helpers</h2>
|
|
1308
|
+
<table class="table">
|
|
1309
|
+
<thead class="table-light">
|
|
1310
|
+
<tr class="text-nowrap">
|
|
1311
|
+
<th>Helper</th>
|
|
1312
|
+
<th>Description</th>
|
|
1313
|
+
</tr>
|
|
1314
|
+
</thead>
|
|
1315
|
+
<tbody>
|
|
1316
|
+
<tr>
|
|
1317
|
+
<td class="text-nowrap"><code class="h5">format_date</code></td>
|
|
1318
|
+
<td class="w-100">
|
|
1319
|
+
<p>Use moment to format the date.</p>
|
|
1320
|
+
<h6>Parameters</h6>
|
|
1321
|
+
<ul>
|
|
1322
|
+
<li><code>string</code> format A format string based on moment.</li>
|
|
1323
|
+
<li><code>string</code> date Date string to format.</li>
|
|
1324
|
+
<li><code>string|string[]</code> locale Language or language-country locale string (or array of strings) available in <a href="https://github.com/moment/moment/tree/develop/locale" target="_blank">https://github.com/moment/moment/tree/develop/locale</a>.</li>
|
|
1325
|
+
</ul>
|
|
1326
|
+
<h6>Return value</h6>
|
|
1327
|
+
<p><code>string</code> Returns formatted date.</p>
|
|
1328
|
+
<h6>Usage:</h6>
|
|
1329
|
+
<div class="highlight">
|
|
1330
|
+
<pre><code class="html">{{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
|
|
1331
|
+
{{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
|
|
1332
|
+
{{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24</code></pre>
|
|
1333
|
+
</div>
|
|
1334
|
+
</td>
|
|
1335
|
+
</tr>
|
|
1336
|
+
</tbody>
|
|
1337
|
+
</table>
|
|
1306
1338
|
<!-- end::Views -->
|
|
1307
1339
|
|
|
1308
1340
|
<!-- begin::Model -->
|
package/package.json
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Use moment to format the date.
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
|
-
* {{
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Parses the given string using JSON.parse.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* {{json_parse value}}
|
|
17
|
-
*
|
|
18
|
-
* @param {any} value Object to stringify.
|
|
19
|
-
* @return {any} JavaScript value or object described by a string.
|
|
5
|
+
* {{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z"}} => 2021/10/24
|
|
6
|
+
* {{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'jp'}} => 2021/10/24
|
|
7
|
+
* {{format_date 'YYYY/MM/DD' "2021-10-24T02:13:06.610Z" 'es'}} => 2021/10/24
|
|
8
|
+
*
|
|
9
|
+
* @param {string} format A format string based on moment.
|
|
10
|
+
* @param {string} date Date string to format.
|
|
11
|
+
* @param {string|string[]} locale Language or language-country locale string (or array of strings) available in https://github.com/moment/moment/tree/develop/locale .
|
|
12
|
+
* @returns {string} Returns formatted date.
|
|
20
13
|
*/
|
|
21
|
-
export declare function
|
|
14
|
+
export declare function format_date(format: string, date: string, locale: string | string[]): string;
|
|
@@ -2,4 +2,5 @@ import * as html from './html';
|
|
|
2
2
|
import * as object from './object';
|
|
3
3
|
import * as string from './string';
|
|
4
4
|
import * as comparison from './comparison';
|
|
5
|
-
|
|
5
|
+
import * as date from './date';
|
|
6
|
+
export { html, object, string, comparison, date };
|
package/types/utils/index.d.ts
CHANGED