cn-time-parser 1.0.0 → 1.0.1
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/README.md +6 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,41 +12,18 @@
|
|
|
12
12
|
- **节日匹配** — 春节、五一、国庆、元旦、清明、元宵,支持 `今年/去年/明年` 前缀
|
|
13
13
|
- **输出信息** — 公历日期、Unix 毫秒时间戳、农历信息、生肖、节气、工作日/节假日判断
|
|
14
14
|
|
|
15
|
-
## 快速开始
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# 克隆项目后安装依赖
|
|
19
|
-
npm install
|
|
20
|
-
|
|
21
|
-
# 直接运行
|
|
22
|
-
node scripts/parse-time.js -q "今天"
|
|
23
|
-
node scripts/parse-time.js "农历二月二十五"
|
|
24
|
-
|
|
25
|
-
# 或通过 npm scripts
|
|
26
|
-
npm start -- --query "今年五一"
|
|
27
|
-
npm test
|
|
28
|
-
```
|
|
29
15
|
|
|
30
16
|
### 全局安装
|
|
31
17
|
|
|
32
|
-
**方式一:npm link(开发推荐)**
|
|
33
18
|
```bash
|
|
34
|
-
|
|
35
|
-
npm link
|
|
36
|
-
cn-time-parser -q "今天"
|
|
37
|
-
# 解除:npm unlink -g cn-time-parser
|
|
19
|
+
npm install -g cn-time-parser
|
|
38
20
|
```
|
|
39
21
|
|
|
40
|
-
**方式二:npm install -g**
|
|
41
|
-
```bash
|
|
42
|
-
cd /path/to/cn-time-parser
|
|
43
|
-
npm install -g .
|
|
44
|
-
```
|
|
45
22
|
|
|
46
23
|
## CLI 用法
|
|
47
24
|
|
|
48
25
|
```
|
|
49
|
-
|
|
26
|
+
cn-time-parser [选项] [查询...]
|
|
50
27
|
```
|
|
51
28
|
|
|
52
29
|
### 传入查询
|
|
@@ -71,13 +48,13 @@ node scripts/parse-time.js [选项] [查询...]
|
|
|
71
48
|
|
|
72
49
|
```bash
|
|
73
50
|
# JSON(默认)
|
|
74
|
-
|
|
51
|
+
cn-time-parser "今年五一"
|
|
75
52
|
|
|
76
53
|
# 文本
|
|
77
|
-
|
|
54
|
+
cn-time-parser "明天" --format text
|
|
78
55
|
|
|
79
56
|
# 仅日期
|
|
80
|
-
|
|
57
|
+
cn-time-parser "后天" --format simple
|
|
81
58
|
```
|
|
82
59
|
|
|
83
60
|
## 支持的时间表达式
|
|
@@ -163,7 +140,7 @@ cn-time-parser "清明节"
|
|
|
163
140
|
cn-time-parser "元宵节"
|
|
164
141
|
|
|
165
142
|
# 指定年份
|
|
166
|
-
cn-time-parser "
|
|
143
|
+
cn-time-parser "农历二月二十五" --year 2025
|
|
167
144
|
```
|
|
168
145
|
|
|
169
146
|
## 依赖
|