@arronqzy/blueprint-dsl 1.0.14 → 1.0.16
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/dist/index.cjs +1570 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +671 -13
- package/dist/index.d.ts +671 -13
- package/dist/index.js +1540 -79
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/readme.md +35 -26
- package/vendor/dayjs/LICENSE +21 -0
- package/vendor/dayjs/esm/constant.js +25 -0
- package/vendor/dayjs/esm/index.d.ts +429 -0
- package/vendor/dayjs/esm/index.js +541 -0
- package/vendor/dayjs/esm/locale/en.js +12 -0
- package/vendor/dayjs/esm/utils.js +58 -0
- package/vendor/dayjs/index.d.ts +429 -0
- package/vendor/dayjs/package.json +85 -0
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arronqzy/blueprint-dsl",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Abuilder blueprint DSL runtime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
-
"readme.md"
|
|
9
|
+
"readme.md",
|
|
10
|
+
"vendor"
|
|
10
11
|
],
|
|
11
12
|
"main": "./dist/index.cjs",
|
|
12
13
|
"module": "./dist/index.js",
|
|
@@ -25,8 +26,8 @@
|
|
|
25
26
|
"eslint": "^8.57.0",
|
|
26
27
|
"tsup": "^8.4.0",
|
|
27
28
|
"typescript": "^5.5.4",
|
|
28
|
-
"@arronqzy/
|
|
29
|
-
"@arronqzy/
|
|
29
|
+
"@arronqzy/typescript-config": "1.0.0",
|
|
30
|
+
"@arronqzy/eslint-config": "0.0.0"
|
|
30
31
|
},
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|
package/readme.md
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
# @arronqzy/blueprint-dsl
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
蓝图的节点定义和运行时。没有 UI。React Flow / Vue Flow 只负责画;节点收到信号后做什么,在这个包里。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
上层画布见 `@arronqzy/react-blueprint` 和 `@arronqzy/vue-blueprint`。
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## 内置节点在干什么
|
|
10
|
+
|
|
11
|
+
| 类型 | 作用 |
|
|
12
|
+
|------|------|
|
|
13
|
+
| 生命周期 | 页面挂载、卸载等阶段发信号,常作为一条链的起点 |
|
|
14
|
+
| 事件 | 视图节点点击等事件进来 |
|
|
15
|
+
| 请求 | HTTP,URL / 头 / 体可带 Scope 模版 |
|
|
16
|
+
| JSON | 解析、取值、拼对象 |
|
|
17
|
+
| 存储 | 读写本地存储,key 可补全 |
|
|
18
|
+
| 逻辑 | 条件分支 |
|
|
19
|
+
| 与门 | 多路信号汇合 |
|
|
20
|
+
| 时钟 | 定时 tick,可中止 |
|
|
21
|
+
| 蓝图 | 引用蓝图库里的另一张图 |
|
|
22
|
+
|
|
23
|
+
假信号默认会堵住下游。节点上可以打开「允许假信号传递」,错误结果也继续往下走。视图侧用 `{scope.xxx}` 读这些节点写进 Scope 的值,模版解析也在本包(`scope-template`)。
|
|
13
24
|
|
|
14
25
|
## 安装
|
|
15
26
|
|
|
@@ -17,7 +28,7 @@ Abuilder 蓝图的 **DSL 与运行时** 包,定义节点类型、行为注册
|
|
|
17
28
|
pnpm add @arronqzy/blueprint-dsl rxjs
|
|
18
29
|
```
|
|
19
30
|
|
|
20
|
-
##
|
|
31
|
+
## 注册自己的行为
|
|
21
32
|
|
|
22
33
|
```ts
|
|
23
34
|
import {
|
|
@@ -51,23 +62,21 @@ await executor.executeToken({
|
|
|
51
62
|
});
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
60
|
-
| `core/
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `runtime/
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- **`@arronqzy/react-blueprint`**:React Flow 画布、调试 UI、蓝图库
|
|
70
|
-
- **`@arronqzy/react-view`**:蓝图执行结果通过 Scope 驱动视图节点
|
|
65
|
+
编辑器里的内置节点已经注册好。上面这段是扩展点,不是使用 Abuilder 的必经步骤。
|
|
66
|
+
|
|
67
|
+
## 模块
|
|
68
|
+
|
|
69
|
+
| 导出所在 | 说明 |
|
|
70
|
+
|----------|------|
|
|
71
|
+
| `core/behavior` | 行为接口与 IO |
|
|
72
|
+
| `core/behavior-registry` | 注册 JS / 内置行为 |
|
|
73
|
+
| `core/executor` | 单节点执行 |
|
|
74
|
+
| `runtime/graph-runner` | 整图调度、环检测 |
|
|
75
|
+
| `runtime/execution-trace` | 执行轨迹(日志面板的数据源) |
|
|
76
|
+
| `runtime/clock-scheduler` | 时钟 tick、中止、活跃订阅 |
|
|
77
|
+
| `nodes/definitions` | 内置节点定义 |
|
|
78
|
+
| `scope-template` / `scope-autocomplete` | `{scope.xxx}` 解析与补全 |
|
|
79
|
+
| `fetch-config` / `logic-config` / `clock-config` / `json-config` / `storage-config` / `event-config` | 各节点配置结构 |
|
|
71
80
|
|
|
72
81
|
## 许可证
|
|
73
82
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-present, iamkun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export var SECONDS_A_MINUTE = 60;
|
|
2
|
+
export var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
|
|
3
|
+
export var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
|
|
4
|
+
export var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
|
|
5
|
+
export var MILLISECONDS_A_SECOND = 1e3;
|
|
6
|
+
export var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
|
|
7
|
+
export var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
|
|
8
|
+
export var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
|
|
9
|
+
export var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales
|
|
10
|
+
|
|
11
|
+
export var MS = 'millisecond';
|
|
12
|
+
export var S = 'second';
|
|
13
|
+
export var MIN = 'minute';
|
|
14
|
+
export var H = 'hour';
|
|
15
|
+
export var D = 'day';
|
|
16
|
+
export var W = 'week';
|
|
17
|
+
export var M = 'month';
|
|
18
|
+
export var Q = 'quarter';
|
|
19
|
+
export var Y = 'year';
|
|
20
|
+
export var DATE = 'date';
|
|
21
|
+
export var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
22
|
+
export var INVALID_DATE_STRING = 'Invalid Date'; // regex
|
|
23
|
+
|
|
24
|
+
export var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
|
|
25
|
+
export var REGEX_FORMAT = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
/// <reference path="./locale/index.d.ts" />
|
|
2
|
+
|
|
3
|
+
export = dayjs;
|
|
4
|
+
|
|
5
|
+
declare function dayjs (date?: dayjs.ConfigType): dayjs.Dayjs
|
|
6
|
+
|
|
7
|
+
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, strict?: boolean): dayjs.Dayjs
|
|
8
|
+
|
|
9
|
+
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean): dayjs.Dayjs
|
|
10
|
+
|
|
11
|
+
declare namespace dayjs {
|
|
12
|
+
interface ConfigTypeMap {
|
|
13
|
+
default: string | number | Date | Dayjs | null | undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap]
|
|
17
|
+
|
|
18
|
+
export interface FormatObject { locale?: string, format?: string, utc?: boolean }
|
|
19
|
+
|
|
20
|
+
export type OptionType = FormatObject | string | string[]
|
|
21
|
+
|
|
22
|
+
export type UnitTypeShort = 'd' | 'D' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
|
|
23
|
+
|
|
24
|
+
export type UnitTypeLong = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date'
|
|
25
|
+
|
|
26
|
+
export type UnitTypeLongPlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' | 'dates'
|
|
27
|
+
|
|
28
|
+
export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort;
|
|
29
|
+
|
|
30
|
+
export type OpUnitType = UnitType | "week" | "weeks" | 'w';
|
|
31
|
+
export type QUnitType = UnitType | "quarter" | "quarters" | 'Q';
|
|
32
|
+
export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'>;
|
|
33
|
+
class Dayjs {
|
|
34
|
+
constructor (config?: ConfigType)
|
|
35
|
+
/**
|
|
36
|
+
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one.
|
|
37
|
+
* ```
|
|
38
|
+
* dayjs().clone()// => Dayjs
|
|
39
|
+
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it
|
|
40
|
+
* ```
|
|
41
|
+
* Docs: https://day.js.org/docs/en/parse/dayjs-clone
|
|
42
|
+
*/
|
|
43
|
+
clone(): Dayjs
|
|
44
|
+
/**
|
|
45
|
+
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not.
|
|
46
|
+
* ```
|
|
47
|
+
* dayjs().isValid()// => boolean
|
|
48
|
+
* ```
|
|
49
|
+
* Docs: https://day.js.org/docs/en/parse/is-valid
|
|
50
|
+
*/
|
|
51
|
+
isValid(): boolean
|
|
52
|
+
/**
|
|
53
|
+
* Get the year.
|
|
54
|
+
* ```
|
|
55
|
+
* dayjs().year()// => 2020
|
|
56
|
+
* ```
|
|
57
|
+
* Docs: https://day.js.org/docs/en/get-set/year
|
|
58
|
+
*/
|
|
59
|
+
year(): number
|
|
60
|
+
/**
|
|
61
|
+
* Set the year.
|
|
62
|
+
* ```
|
|
63
|
+
* dayjs().year(2000)// => Dayjs
|
|
64
|
+
* ```
|
|
65
|
+
* Docs: https://day.js.org/docs/en/get-set/year
|
|
66
|
+
*/
|
|
67
|
+
year(value: number): Dayjs
|
|
68
|
+
/**
|
|
69
|
+
* Get the month.
|
|
70
|
+
*
|
|
71
|
+
* Months are zero indexed, so January is month 0.
|
|
72
|
+
* ```
|
|
73
|
+
* dayjs().month()// => 0-11
|
|
74
|
+
* ```
|
|
75
|
+
* Docs: https://day.js.org/docs/en/get-set/month
|
|
76
|
+
*/
|
|
77
|
+
month(): number
|
|
78
|
+
/**
|
|
79
|
+
* Set the month.
|
|
80
|
+
*
|
|
81
|
+
* Months are zero indexed, so January is month 0.
|
|
82
|
+
*
|
|
83
|
+
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the next year.
|
|
84
|
+
* ```
|
|
85
|
+
* dayjs().month(0)// => Dayjs
|
|
86
|
+
* ```
|
|
87
|
+
* Docs: https://day.js.org/docs/en/get-set/month
|
|
88
|
+
*/
|
|
89
|
+
month(value: number): Dayjs
|
|
90
|
+
/**
|
|
91
|
+
* Get the date of the month.
|
|
92
|
+
* ```
|
|
93
|
+
* dayjs().date()// => 1-31
|
|
94
|
+
* ```
|
|
95
|
+
* Docs: https://day.js.org/docs/en/get-set/date
|
|
96
|
+
*/
|
|
97
|
+
date(): number
|
|
98
|
+
/**
|
|
99
|
+
* Set the date of the month.
|
|
100
|
+
*
|
|
101
|
+
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the next months.
|
|
102
|
+
* ```
|
|
103
|
+
* dayjs().date(1)// => Dayjs
|
|
104
|
+
* ```
|
|
105
|
+
* Docs: https://day.js.org/docs/en/get-set/date
|
|
106
|
+
*/
|
|
107
|
+
date(value: number): Dayjs
|
|
108
|
+
/**
|
|
109
|
+
* Get the day of the week.
|
|
110
|
+
*
|
|
111
|
+
* Returns numbers from 0 (Sunday) to 6 (Saturday).
|
|
112
|
+
* ```
|
|
113
|
+
* dayjs().day()// 0-6
|
|
114
|
+
* ```
|
|
115
|
+
* Docs: https://day.js.org/docs/en/get-set/day
|
|
116
|
+
*/
|
|
117
|
+
day(): 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
118
|
+
/**
|
|
119
|
+
* Set the day of the week.
|
|
120
|
+
*
|
|
121
|
+
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to next weeks.
|
|
122
|
+
* ```
|
|
123
|
+
* dayjs().day(0)// => Dayjs
|
|
124
|
+
* ```
|
|
125
|
+
* Docs: https://day.js.org/docs/en/get-set/day
|
|
126
|
+
*/
|
|
127
|
+
day(value: number): Dayjs
|
|
128
|
+
/**
|
|
129
|
+
* Get the hour.
|
|
130
|
+
* ```
|
|
131
|
+
* dayjs().hour()// => 0-23
|
|
132
|
+
* ```
|
|
133
|
+
* Docs: https://day.js.org/docs/en/get-set/hour
|
|
134
|
+
*/
|
|
135
|
+
hour(): number
|
|
136
|
+
/**
|
|
137
|
+
* Set the hour.
|
|
138
|
+
*
|
|
139
|
+
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the next day.
|
|
140
|
+
* ```
|
|
141
|
+
* dayjs().hour(12)// => Dayjs
|
|
142
|
+
* ```
|
|
143
|
+
* Docs: https://day.js.org/docs/en/get-set/hour
|
|
144
|
+
*/
|
|
145
|
+
hour(value: number): Dayjs
|
|
146
|
+
/**
|
|
147
|
+
* Get the minutes.
|
|
148
|
+
* ```
|
|
149
|
+
* dayjs().minute()// => 0-59
|
|
150
|
+
* ```
|
|
151
|
+
* Docs: https://day.js.org/docs/en/get-set/minute
|
|
152
|
+
*/
|
|
153
|
+
minute(): number
|
|
154
|
+
/**
|
|
155
|
+
* Set the minutes.
|
|
156
|
+
*
|
|
157
|
+
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next hour.
|
|
158
|
+
* ```
|
|
159
|
+
* dayjs().minute(59)// => Dayjs
|
|
160
|
+
* ```
|
|
161
|
+
* Docs: https://day.js.org/docs/en/get-set/minute
|
|
162
|
+
*/
|
|
163
|
+
minute(value: number): Dayjs
|
|
164
|
+
/**
|
|
165
|
+
* Get the seconds.
|
|
166
|
+
* ```
|
|
167
|
+
* dayjs().second()// => 0-59
|
|
168
|
+
* ```
|
|
169
|
+
* Docs: https://day.js.org/docs/en/get-set/second
|
|
170
|
+
*/
|
|
171
|
+
second(): number
|
|
172
|
+
/**
|
|
173
|
+
* Set the seconds.
|
|
174
|
+
*
|
|
175
|
+
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next minutes.
|
|
176
|
+
* ```
|
|
177
|
+
* dayjs().second(1)// Dayjs
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
second(value: number): Dayjs
|
|
181
|
+
/**
|
|
182
|
+
* Get the milliseconds.
|
|
183
|
+
* ```
|
|
184
|
+
* dayjs().millisecond()// => 0-999
|
|
185
|
+
* ```
|
|
186
|
+
* Docs: https://day.js.org/docs/en/get-set/millisecond
|
|
187
|
+
*/
|
|
188
|
+
millisecond(): number
|
|
189
|
+
/**
|
|
190
|
+
* Set the milliseconds.
|
|
191
|
+
*
|
|
192
|
+
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the next seconds.
|
|
193
|
+
* ```
|
|
194
|
+
* dayjs().millisecond(1)// => Dayjs
|
|
195
|
+
* ```
|
|
196
|
+
* Docs: https://day.js.org/docs/en/get-set/millisecond
|
|
197
|
+
*/
|
|
198
|
+
millisecond(value: number): Dayjs
|
|
199
|
+
/**
|
|
200
|
+
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes.
|
|
201
|
+
*
|
|
202
|
+
* In general:
|
|
203
|
+
* ```
|
|
204
|
+
* dayjs().set(unit, value) === dayjs()[unit](value)
|
|
205
|
+
* ```
|
|
206
|
+
* Units are case insensitive, and support plural and short forms.
|
|
207
|
+
* ```
|
|
208
|
+
* dayjs().set('date', 1)
|
|
209
|
+
* dayjs().set('month', 3) // April
|
|
210
|
+
* dayjs().set('second', 30)
|
|
211
|
+
* ```
|
|
212
|
+
* Docs: https://day.js.org/docs/en/get-set/set
|
|
213
|
+
*/
|
|
214
|
+
set(unit: UnitType, value: number): Dayjs
|
|
215
|
+
/**
|
|
216
|
+
* String getter, returns the corresponding information getting from Day.js object.
|
|
217
|
+
*
|
|
218
|
+
* In general:
|
|
219
|
+
* ```
|
|
220
|
+
* dayjs().get(unit) === dayjs()[unit]()
|
|
221
|
+
* ```
|
|
222
|
+
* Units are case insensitive, and support plural and short forms.
|
|
223
|
+
* ```
|
|
224
|
+
* dayjs().get('year')
|
|
225
|
+
* dayjs().get('month') // start 0
|
|
226
|
+
* dayjs().get('date')
|
|
227
|
+
* ```
|
|
228
|
+
* Docs: https://day.js.org/docs/en/get-set/get
|
|
229
|
+
*/
|
|
230
|
+
get(unit: UnitType): number
|
|
231
|
+
/**
|
|
232
|
+
* Returns a cloned Day.js object with a specified amount of time added.
|
|
233
|
+
* ```
|
|
234
|
+
* dayjs().add(7, 'day')// => Dayjs
|
|
235
|
+
* ```
|
|
236
|
+
* Units are case insensitive, and support plural and short forms.
|
|
237
|
+
*
|
|
238
|
+
* Docs: https://day.js.org/docs/en/manipulate/add
|
|
239
|
+
*/
|
|
240
|
+
add(value: number, unit?: ManipulateType): Dayjs
|
|
241
|
+
/**
|
|
242
|
+
* Returns a cloned Day.js object with a specified amount of time subtracted.
|
|
243
|
+
* ```
|
|
244
|
+
* dayjs().subtract(7, 'year')// => Dayjs
|
|
245
|
+
* ```
|
|
246
|
+
* Units are case insensitive, and support plural and short forms.
|
|
247
|
+
*
|
|
248
|
+
* Docs: https://day.js.org/docs/en/manipulate/subtract
|
|
249
|
+
*/
|
|
250
|
+
subtract(value: number, unit?: ManipulateType): Dayjs
|
|
251
|
+
/**
|
|
252
|
+
* Returns a cloned Day.js object and set it to the start of a unit of time.
|
|
253
|
+
* ```
|
|
254
|
+
* dayjs().startOf('year')// => Dayjs
|
|
255
|
+
* ```
|
|
256
|
+
* Units are case insensitive, and support plural and short forms.
|
|
257
|
+
*
|
|
258
|
+
* Docs: https://day.js.org/docs/en/manipulate/start-of
|
|
259
|
+
*/
|
|
260
|
+
startOf(unit: OpUnitType): Dayjs
|
|
261
|
+
/**
|
|
262
|
+
* Returns a cloned Day.js object and set it to the end of a unit of time.
|
|
263
|
+
* ```
|
|
264
|
+
* dayjs().endOf('month')// => Dayjs
|
|
265
|
+
* ```
|
|
266
|
+
* Units are case insensitive, and support plural and short forms.
|
|
267
|
+
*
|
|
268
|
+
* Docs: https://day.js.org/docs/en/manipulate/end-of
|
|
269
|
+
*/
|
|
270
|
+
endOf(unit: OpUnitType): Dayjs
|
|
271
|
+
/**
|
|
272
|
+
* Get the formatted date according to the string of tokens passed in.
|
|
273
|
+
*
|
|
274
|
+
* To escape characters, wrap them in square brackets (e.g. [MM]).
|
|
275
|
+
* ```
|
|
276
|
+
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00'
|
|
277
|
+
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z'
|
|
278
|
+
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
|
|
279
|
+
* ```
|
|
280
|
+
* Docs: https://day.js.org/docs/en/display/format
|
|
281
|
+
*/
|
|
282
|
+
format(template?: string): string
|
|
283
|
+
/**
|
|
284
|
+
* This indicates the difference between two date-time in the specified unit.
|
|
285
|
+
*
|
|
286
|
+
* To get the difference in milliseconds, use `dayjs#diff`
|
|
287
|
+
* ```
|
|
288
|
+
* const date1 = dayjs('2019-01-25')
|
|
289
|
+
* const date2 = dayjs('2018-06-05')
|
|
290
|
+
* date1.diff(date2) // 20214000000 default milliseconds
|
|
291
|
+
* date1.diff() // milliseconds to current time
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* To get the difference in another unit of measurement, pass that measurement as the second argument.
|
|
295
|
+
* ```
|
|
296
|
+
* const date1 = dayjs('2019-01-25')
|
|
297
|
+
* date1.diff('2018-06-05', 'month') // 7
|
|
298
|
+
* ```
|
|
299
|
+
* Units are case insensitive, and support plural and short forms.
|
|
300
|
+
*
|
|
301
|
+
* Docs: https://day.js.org/docs/en/display/difference
|
|
302
|
+
*/
|
|
303
|
+
diff(date?: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number
|
|
304
|
+
/**
|
|
305
|
+
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object.
|
|
306
|
+
* ```
|
|
307
|
+
* dayjs('2019-01-25').valueOf() // 1548381600000
|
|
308
|
+
* +dayjs(1548381600000) // 1548381600000
|
|
309
|
+
* ```
|
|
310
|
+
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`.
|
|
311
|
+
*
|
|
312
|
+
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds
|
|
313
|
+
*/
|
|
314
|
+
valueOf(): number
|
|
315
|
+
/**
|
|
316
|
+
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object.
|
|
317
|
+
* ```
|
|
318
|
+
* dayjs('2019-01-25').unix() // 1548381600
|
|
319
|
+
* ```
|
|
320
|
+
* This value is floored to the nearest second, and does not include a milliseconds component.
|
|
321
|
+
*
|
|
322
|
+
* Docs: https://day.js.org/docs/en/display/unix-timestamp
|
|
323
|
+
*/
|
|
324
|
+
unix(): number
|
|
325
|
+
/**
|
|
326
|
+
* Get the number of days in the current month.
|
|
327
|
+
* ```
|
|
328
|
+
* dayjs('2019-01-25').daysInMonth() // 31
|
|
329
|
+
* ```
|
|
330
|
+
* Docs: https://day.js.org/docs/en/display/days-in-month
|
|
331
|
+
*/
|
|
332
|
+
daysInMonth(): number
|
|
333
|
+
/**
|
|
334
|
+
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`.
|
|
335
|
+
* ```
|
|
336
|
+
* dayjs('2019-01-25').toDate()// => Date
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
toDate(): Date
|
|
340
|
+
/**
|
|
341
|
+
* To serialize as an ISO 8601 string.
|
|
342
|
+
* ```
|
|
343
|
+
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z'
|
|
344
|
+
* ```
|
|
345
|
+
* Docs: https://day.js.org/docs/en/display/as-json
|
|
346
|
+
*/
|
|
347
|
+
toJSON(): string
|
|
348
|
+
/**
|
|
349
|
+
* To format as an ISO 8601 string.
|
|
350
|
+
* ```
|
|
351
|
+
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z'
|
|
352
|
+
* ```
|
|
353
|
+
* Docs: https://day.js.org/docs/en/display/as-iso-string
|
|
354
|
+
*/
|
|
355
|
+
toISOString(): string
|
|
356
|
+
/**
|
|
357
|
+
* Returns a string representation of the date.
|
|
358
|
+
* ```
|
|
359
|
+
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT'
|
|
360
|
+
* ```
|
|
361
|
+
* Docs: https://day.js.org/docs/en/display/as-string
|
|
362
|
+
*/
|
|
363
|
+
toString(): string
|
|
364
|
+
/**
|
|
365
|
+
* Get the UTC offset in minutes.
|
|
366
|
+
* ```
|
|
367
|
+
* dayjs().utcOffset()
|
|
368
|
+
* ```
|
|
369
|
+
* Docs: https://day.js.org/docs/en/manipulate/utc-offset
|
|
370
|
+
*/
|
|
371
|
+
utcOffset(): number
|
|
372
|
+
/**
|
|
373
|
+
* This indicates whether the Day.js object is before the other supplied date-time.
|
|
374
|
+
* ```
|
|
375
|
+
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds
|
|
376
|
+
* ```
|
|
377
|
+
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
|
|
378
|
+
* ```
|
|
379
|
+
* dayjs().isBefore('2011-01-01', 'year')// => boolean
|
|
380
|
+
* ```
|
|
381
|
+
* Units are case insensitive, and support plural and short forms.
|
|
382
|
+
*
|
|
383
|
+
* Docs: https://day.js.org/docs/en/query/is-before
|
|
384
|
+
*/
|
|
385
|
+
isBefore(date?: ConfigType, unit?: OpUnitType): boolean
|
|
386
|
+
/**
|
|
387
|
+
* This indicates whether the Day.js object is the same as the other supplied date-time.
|
|
388
|
+
* ```
|
|
389
|
+
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds
|
|
390
|
+
* ```
|
|
391
|
+
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
|
|
392
|
+
* ```
|
|
393
|
+
* dayjs().isSame('2011-01-01', 'year')// => boolean
|
|
394
|
+
* ```
|
|
395
|
+
* Docs: https://day.js.org/docs/en/query/is-same
|
|
396
|
+
*/
|
|
397
|
+
isSame(date?: ConfigType, unit?: OpUnitType): boolean
|
|
398
|
+
/**
|
|
399
|
+
* This indicates whether the Day.js object is after the other supplied date-time.
|
|
400
|
+
* ```
|
|
401
|
+
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds
|
|
402
|
+
* ```
|
|
403
|
+
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
|
|
404
|
+
* ```
|
|
405
|
+
* dayjs().isAfter('2011-01-01', 'year')// => boolean
|
|
406
|
+
* ```
|
|
407
|
+
* Units are case insensitive, and support plural and short forms.
|
|
408
|
+
*
|
|
409
|
+
* Docs: https://day.js.org/docs/en/query/is-after
|
|
410
|
+
*/
|
|
411
|
+
isAfter(date?: ConfigType, unit?: OpUnitType): boolean
|
|
412
|
+
|
|
413
|
+
locale(): string
|
|
414
|
+
|
|
415
|
+
locale(preset: string | ILocale, object?: Partial<ILocale>): Dayjs
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export type PluginFunc<T = unknown> = (option: T, c: typeof Dayjs, d: typeof dayjs) => void
|
|
419
|
+
|
|
420
|
+
export function extend<T = unknown>(plugin: PluginFunc<T>, option?: T): Dayjs
|
|
421
|
+
|
|
422
|
+
export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string
|
|
423
|
+
|
|
424
|
+
export function isDayjs(d: any): d is Dayjs
|
|
425
|
+
|
|
426
|
+
export function unix(t: number): Dayjs
|
|
427
|
+
|
|
428
|
+
const Ls : { [key: string] : ILocale }
|
|
429
|
+
}
|