ly-utils-lib 1.0.12 → 2.4.0
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/LICENSE +21 -0
- package/README.md +889 -686
- package/dist/array.cjs +237 -0
- package/dist/array.cjs.map +1 -0
- package/dist/array.d.cts +2 -0
- package/dist/array.d.ts +2 -0
- package/dist/array.js +150 -0
- package/dist/array.js.map +1 -0
- package/dist/crypto.cjs +193 -0
- package/dist/crypto.cjs.map +1 -0
- package/dist/crypto.d.cts +3 -0
- package/dist/crypto.d.ts +3 -0
- package/dist/crypto.js +144 -0
- package/dist/crypto.js.map +1 -0
- package/dist/date.cjs +563 -0
- package/dist/date.cjs.map +1 -0
- package/dist/date.d.cts +2 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +451 -0
- package/dist/date.js.map +1 -0
- package/dist/excel.cjs +227 -0
- package/dist/excel.cjs.map +1 -0
- package/dist/excel.d.cts +2 -0
- package/dist/excel.d.ts +2 -0
- package/dist/excel.js +196 -0
- package/dist/excel.js.map +1 -0
- package/dist/index-B80SEVzM.d.cts +382 -0
- package/dist/index-B80SEVzM.d.ts +382 -0
- package/dist/index-Ba1rjTzj.d.cts +299 -0
- package/dist/index-Ba1rjTzj.d.ts +299 -0
- package/dist/index-Bg1ise7y.d.cts +253 -0
- package/dist/index-Bg1ise7y.d.ts +253 -0
- package/dist/index-BoqNpwNa.d.cts +203 -0
- package/dist/index-BoqNpwNa.d.ts +203 -0
- package/dist/index-C0qUnb9Y.d.cts +533 -0
- package/dist/index-C0qUnb9Y.d.ts +533 -0
- package/dist/index-Cy-mb5v_.d.cts +262 -0
- package/dist/index-Cy-mb5v_.d.ts +262 -0
- package/dist/index-D1f9Sym2.d.cts +148 -0
- package/dist/index-D1f9Sym2.d.ts +148 -0
- package/dist/index-Dan5oF-5.d.cts +213 -0
- package/dist/index-Dan5oF-5.d.ts +213 -0
- package/dist/index-XABfrs7z.d.cts +596 -0
- package/dist/index-XABfrs7z.d.ts +596 -0
- package/dist/index-YXWfKCK7.d.cts +109 -0
- package/dist/index-YXWfKCK7.d.ts +109 -0
- package/dist/index.cjs +3355 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +3294 -0
- package/dist/index.js.map +1 -0
- package/dist/map.cjs +839 -0
- package/dist/map.cjs.map +1 -0
- package/dist/map.d.cts +6 -0
- package/dist/map.d.ts +6 -0
- package/dist/map.js +811 -0
- package/dist/map.js.map +1 -0
- package/dist/object.cjs +316 -0
- package/dist/object.cjs.map +1 -0
- package/dist/object.d.cts +2 -0
- package/dist/object.d.ts +2 -0
- package/dist/object.js +247 -0
- package/dist/object.js.map +1 -0
- package/dist/pdf.cjs +197 -0
- package/dist/pdf.cjs.map +1 -0
- package/dist/pdf.d.cts +3 -0
- package/dist/pdf.d.ts +3 -0
- package/dist/pdf.js +173 -0
- package/dist/pdf.js.map +1 -0
- package/dist/storage.cjs +255 -0
- package/dist/storage.cjs.map +1 -0
- package/dist/storage.d.cts +1 -0
- package/dist/storage.d.ts +1 -0
- package/dist/storage.js +226 -0
- package/dist/storage.js.map +1 -0
- package/dist/string.cjs +232 -0
- package/dist/string.cjs.map +1 -0
- package/dist/string.d.cts +2 -0
- package/dist/string.d.ts +2 -0
- package/dist/string.js +170 -0
- package/dist/string.js.map +1 -0
- package/dist/utils.cjs +429 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +2 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +371 -0
- package/dist/utils.js.map +1 -0
- package/package.json +159 -33
- package/dist/ly-utils-lib.cjs.js +0 -115
- package/dist/ly-utils-lib.cjs.js.map +0 -1
- package/dist/ly-utils-lib.es.js +0 -58589
- package/dist/ly-utils-lib.es.js.map +0 -1
- package/dist/ly-utils-lib.umd.js +0 -115
- package/dist/ly-utils-lib.umd.js.map +0 -1
- package/dist/types/index.d.ts +0 -15
- package/dist/types/utils/esToolkit.d.ts +0 -2
- package/dist/types/utils/ol.d.ts +0 -175
- package/dist/types/utils/router.d.ts +0 -10
- package/dist/types/utils/storage.d.ts +0 -42
- package/dist/types/utils/time.d.ts +0 -66
- package/dist/types/utils/tool.d.ts +0 -80
- package/dist/vite.svg +0 -1
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 日期时间工具模块
|
|
5
|
+
* 基于 dayjs 封装,提供常用的日期处理功能
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 时间单位类型
|
|
10
|
+
*/
|
|
11
|
+
type TimeUnit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
12
|
+
/**
|
|
13
|
+
* 日期格式类型
|
|
14
|
+
*/
|
|
15
|
+
type DateFormat = 'YYYY-MM-DD' | 'YYYY-MM-DD HH:mm:ss' | 'YYYY-MM-DD HH:mm' | 'YYYY/MM/DD' | 'YYYY/MM/DD HH:mm:ss' | 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'HH:mm:ss' | 'HH:mm' | 'YYYY-MM-DDTHH:mm:ss' | 'YYYY年MM月DD日' | 'YYYY年MM月DD日 HH:mm:ss';
|
|
16
|
+
/**
|
|
17
|
+
* 获取当前时间
|
|
18
|
+
*/
|
|
19
|
+
declare const now: () => Dayjs;
|
|
20
|
+
/**
|
|
21
|
+
* 格式化日期
|
|
22
|
+
* @param date 日期
|
|
23
|
+
* @param format 格式
|
|
24
|
+
*/
|
|
25
|
+
declare const format: (date: string | number | Date | Dayjs, formatStr?: string) => string;
|
|
26
|
+
/**
|
|
27
|
+
* 获取日期的年月日
|
|
28
|
+
* @param date 日期
|
|
29
|
+
*/
|
|
30
|
+
declare const getDate: (date?: string | number | Date | Dayjs) => string;
|
|
31
|
+
/**
|
|
32
|
+
* 获取时间
|
|
33
|
+
* @param date 日期
|
|
34
|
+
*/
|
|
35
|
+
declare const getTime: (date?: string | number | Date | Dayjs) => string;
|
|
36
|
+
/**
|
|
37
|
+
* 获取时间戳
|
|
38
|
+
* @param date 日期
|
|
39
|
+
*/
|
|
40
|
+
declare const getTimestamp: (date?: string | number | Date | Dayjs) => number;
|
|
41
|
+
/**
|
|
42
|
+
* 日期加减
|
|
43
|
+
* @param date 日期
|
|
44
|
+
* @param amount 数量
|
|
45
|
+
* @param unit 单位
|
|
46
|
+
*/
|
|
47
|
+
declare const add: (date: string | number | Date | Dayjs, amount: number, unit?: "year" | "month" | "day" | "hour" | "minute" | "second") => Dayjs;
|
|
48
|
+
/**
|
|
49
|
+
* 日期减法
|
|
50
|
+
* @param date 日期
|
|
51
|
+
* @param amount 数量
|
|
52
|
+
* @param unit 单位
|
|
53
|
+
*/
|
|
54
|
+
declare const subtract: (date: string | number | Date | Dayjs, amount: number, unit?: "year" | "month" | "day" | "hour" | "minute" | "second") => Dayjs;
|
|
55
|
+
/**
|
|
56
|
+
* 获取日期的开始时间(当天的 00:00:00)
|
|
57
|
+
* @param date 日期
|
|
58
|
+
*/
|
|
59
|
+
declare const startOf: (date: string | number | Date | Dayjs, unit?: "day" | "month" | "year") => Dayjs;
|
|
60
|
+
/**
|
|
61
|
+
* 获取日期的结束时间(当天的 23:59:59)
|
|
62
|
+
* @param date 日期
|
|
63
|
+
*/
|
|
64
|
+
declare const endOf: (date: string | number | Date | Dayjs, unit?: "day" | "month" | "year") => Dayjs;
|
|
65
|
+
/**
|
|
66
|
+
* 计算两个日期之间的天数差
|
|
67
|
+
* @param date1 日期1
|
|
68
|
+
* @param date2 日期2
|
|
69
|
+
*/
|
|
70
|
+
declare const diffDays: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => number;
|
|
71
|
+
/**
|
|
72
|
+
* 计算两个日期之间的小时差
|
|
73
|
+
* @param date1 日期1
|
|
74
|
+
* @param date2 日期2
|
|
75
|
+
*/
|
|
76
|
+
declare const diffHours: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => number;
|
|
77
|
+
/**
|
|
78
|
+
* 判断是否是今天
|
|
79
|
+
* @param date 日期
|
|
80
|
+
*/
|
|
81
|
+
declare const isToday: (date: string | number | Date | Dayjs) => boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 判断是否是昨天
|
|
84
|
+
* @param date 日期
|
|
85
|
+
*/
|
|
86
|
+
declare const isYesterday: (date: string | number | Date | Dayjs) => boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 判断是否是明天
|
|
89
|
+
* @param date 日期
|
|
90
|
+
*/
|
|
91
|
+
declare const isTomorrow: (date: string | number | Date | Dayjs) => boolean;
|
|
92
|
+
/**
|
|
93
|
+
* 判断是否在两个日期之间
|
|
94
|
+
* @param date 日期
|
|
95
|
+
* @param startDate 开始日期
|
|
96
|
+
* @param endDate 结束日期
|
|
97
|
+
*/
|
|
98
|
+
declare const isBetween: (date: string | number | Date | Dayjs, startDate: string | number | Date | Dayjs, endDate: string | number | Date | Dayjs) => boolean;
|
|
99
|
+
/**
|
|
100
|
+
* 获取相对时间
|
|
101
|
+
* @param date 日期
|
|
102
|
+
*/
|
|
103
|
+
declare const fromNow: (date: string | number | Date | Dayjs) => string;
|
|
104
|
+
/**
|
|
105
|
+
* 获取周数
|
|
106
|
+
* @param date 日期
|
|
107
|
+
*/
|
|
108
|
+
declare const getWeek: (date?: string | number | Date | Dayjs) => number;
|
|
109
|
+
/**
|
|
110
|
+
* 计算日期(前移或后移)
|
|
111
|
+
* @param compute 计算方式 'after' | 'before'
|
|
112
|
+
* @param date 日期
|
|
113
|
+
* @param type 计算类型 'day' | 'week' | 'month' | 'quarter' | 'year' | 'hour' | 'minute' | 'second' | 'millisecond'
|
|
114
|
+
* @param num 计算数量
|
|
115
|
+
* @param format 格式模板
|
|
116
|
+
* @returns 格式化后的日期字符串
|
|
117
|
+
*/
|
|
118
|
+
declare const computeDate: (compute: "after" | "before", date?: string | number | Date | Dayjs, type?: "day" | "week" | "month" | "quarter" | "year" | "hour" | "minute" | "second" | "millisecond", num?: number, format?: string) => string;
|
|
119
|
+
/**
|
|
120
|
+
* 获取当前时间单位的开始时间
|
|
121
|
+
* @param type 类型 'date' | 'day' | 'month' | 'quarter' | 'year' | 'week' | 'isoWeek' | 'hour' | 'minute' | 'second' | 'millisecond'
|
|
122
|
+
* @param format 格式模板
|
|
123
|
+
* @returns 格式化后的日期字符串
|
|
124
|
+
*/
|
|
125
|
+
declare const startDate: (type?: "date" | "day" | "month" | "quarter" | "year" | "week" | "isoWeek" | "hour" | "minute" | "second" | "millisecond", format?: string) => string;
|
|
126
|
+
/**
|
|
127
|
+
* 获取当前时间单位的结束时间
|
|
128
|
+
* @param type 类型 'date' | 'day' | 'month' | 'quarter' | 'year' | 'week' | 'isoWeek' | 'hour' | 'minute' | 'second' | 'millisecond'
|
|
129
|
+
* @param format 格式模板
|
|
130
|
+
* @returns 格式化后的日期字符串
|
|
131
|
+
*/
|
|
132
|
+
declare const endDate: (type?: "date" | "day" | "month" | "quarter" | "year" | "week" | "isoWeek" | "hour" | "minute" | "second" | "millisecond", format?: string) => string;
|
|
133
|
+
/**
|
|
134
|
+
* 时间戳格式化
|
|
135
|
+
* @param timestamp 时间戳(秒级)
|
|
136
|
+
* @param format 格式模板
|
|
137
|
+
* @returns 格式化后的日期字符串
|
|
138
|
+
*/
|
|
139
|
+
declare const formatTimestamp: (timestamp?: number, format?: string) => string;
|
|
140
|
+
/**
|
|
141
|
+
* 获取两个日期之间的差异(通用版本)
|
|
142
|
+
* @param type 类型 'week' | 'day' | 'month' | 'quarter' | 'year' | 'hour' | 'minute' | 'second' | 'millisecond'
|
|
143
|
+
* @param startDate 起始时间
|
|
144
|
+
* @param endDate 结束时间
|
|
145
|
+
* @returns 差异值
|
|
146
|
+
*/
|
|
147
|
+
declare const diff: (type: "week" | "day" | "month" | "quarter" | "year" | "hour" | "minute" | "second" | "millisecond", startDate: string | number | Date | Dayjs, endDate?: string | number | Date | Dayjs) => number;
|
|
148
|
+
/**
|
|
149
|
+
* 获取日期范围内的所有日期
|
|
150
|
+
* @param startDate 起始时间
|
|
151
|
+
* @param endDate 结束时间
|
|
152
|
+
* @param format 格式模板
|
|
153
|
+
* @returns 日期集合(包含日期和时间戳)
|
|
154
|
+
*/
|
|
155
|
+
declare const getRangeDate: (startDate: string | number | Date | Dayjs, endDate: string | number | Date | Dayjs, format?: string) => Array<{
|
|
156
|
+
day: string;
|
|
157
|
+
timestamp: number;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* 获取相对时间(中文描述)
|
|
161
|
+
* @param date 日期
|
|
162
|
+
* @returns 相对时间描述
|
|
163
|
+
*/
|
|
164
|
+
declare const getRelativeTime: (date: string | number | Date | Dayjs) => string;
|
|
165
|
+
/**
|
|
166
|
+
* 判断日期是否有效
|
|
167
|
+
* @param date 日期
|
|
168
|
+
* @returns 是否有效
|
|
169
|
+
*/
|
|
170
|
+
declare const isValid: (date: string | number | Date | Dayjs) => boolean;
|
|
171
|
+
/**
|
|
172
|
+
* 获取月份的第一天
|
|
173
|
+
* @param date 日期
|
|
174
|
+
* @returns 日期
|
|
175
|
+
*/
|
|
176
|
+
declare const getFirstDayOfMonth: (date?: string | number | Date | Dayjs) => number;
|
|
177
|
+
/**
|
|
178
|
+
* 获取月份的最后一天
|
|
179
|
+
* @param date 日期
|
|
180
|
+
* @returns 日期
|
|
181
|
+
*/
|
|
182
|
+
declare const getLastDayOfMonth: (date?: string | number | Date | Dayjs) => number;
|
|
183
|
+
/**
|
|
184
|
+
* 获取季度
|
|
185
|
+
* @param date 日期
|
|
186
|
+
*/
|
|
187
|
+
declare const getQuarter: (date?: string | number | Date | Dayjs) => number;
|
|
188
|
+
/**
|
|
189
|
+
* 获取某月有多少天
|
|
190
|
+
* @param date 日期
|
|
191
|
+
*/
|
|
192
|
+
declare const getDaysInMonth: (date?: string | number | Date | Dayjs) => number;
|
|
193
|
+
/**
|
|
194
|
+
* 获取当前月份的开始日期和结束日期
|
|
195
|
+
* @param date 日期
|
|
196
|
+
*/
|
|
197
|
+
declare const getMonthRange: (date?: string | number | Date | Dayjs) => [string, string];
|
|
198
|
+
/**
|
|
199
|
+
* 获取当前季度的开始日期和结束日期
|
|
200
|
+
* @param date 日期
|
|
201
|
+
*/
|
|
202
|
+
declare const getQuarterRange: (date?: string | number | Date | Dayjs) => [string, string];
|
|
203
|
+
/**
|
|
204
|
+
* 获取当前年份的开始日期和结束日期
|
|
205
|
+
* @param date 日期
|
|
206
|
+
*/
|
|
207
|
+
declare const getYearRange: (date?: string | number | Date | Dayjs) => [string, string];
|
|
208
|
+
/**
|
|
209
|
+
* 获取本周的开始日期和结束日期
|
|
210
|
+
* @param date 日期
|
|
211
|
+
* @param startDay 一周的开始日,默认为周日(0)
|
|
212
|
+
*/
|
|
213
|
+
declare const getWeekRange: (date?: string | number | Date | Dayjs, startDay?: number) => [string, string];
|
|
214
|
+
/**
|
|
215
|
+
* 判断是否是闰年
|
|
216
|
+
* @param year 年份
|
|
217
|
+
*/
|
|
218
|
+
declare const isLeapYear: (year: number) => boolean;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 获取年份
|
|
222
|
+
* @param date 日期
|
|
223
|
+
*/
|
|
224
|
+
declare const getYear: (date?: string | number | Date | Dayjs) => number;
|
|
225
|
+
/**
|
|
226
|
+
* 获取月份(1-12)
|
|
227
|
+
* @param date 日期
|
|
228
|
+
*/
|
|
229
|
+
declare const getMonth: (date?: string | number | Date | Dayjs) => number;
|
|
230
|
+
/**
|
|
231
|
+
* 获取日期(1-31)
|
|
232
|
+
* @param date 日期
|
|
233
|
+
*/
|
|
234
|
+
declare const getDay: (date?: string | number | Date | Dayjs) => number;
|
|
235
|
+
/**
|
|
236
|
+
* 获取小时(0-23)
|
|
237
|
+
* @param date 日期
|
|
238
|
+
*/
|
|
239
|
+
declare const getHour: (date?: string | number | Date | Dayjs) => number;
|
|
240
|
+
/**
|
|
241
|
+
* 获取分钟(0-59)
|
|
242
|
+
* @param date 日期
|
|
243
|
+
*/
|
|
244
|
+
declare const getMinute: (date?: string | number | Date | Dayjs) => number;
|
|
245
|
+
/**
|
|
246
|
+
* 获取秒数(0-59)
|
|
247
|
+
* @param date 日期
|
|
248
|
+
*/
|
|
249
|
+
declare const getSecond: (date?: string | number | Date | Dayjs) => number;
|
|
250
|
+
/**
|
|
251
|
+
* 获取星期几(0-6,0为周日)
|
|
252
|
+
* @param date 日期
|
|
253
|
+
*/
|
|
254
|
+
declare const getWeekday: (date?: string | number | Date | Dayjs) => number;
|
|
255
|
+
/**
|
|
256
|
+
* 获取星期几的中文名称
|
|
257
|
+
* @param date 日期
|
|
258
|
+
*/
|
|
259
|
+
declare const getWeekdayName: (date?: string | number | Date | Dayjs) => string;
|
|
260
|
+
/**
|
|
261
|
+
* 获取一年中的第几天
|
|
262
|
+
* @param date 日期
|
|
263
|
+
*/
|
|
264
|
+
declare const getDayOfYear: (date?: string | number | Date | Dayjs) => number;
|
|
265
|
+
/**
|
|
266
|
+
* 获取本周第一天(周一)
|
|
267
|
+
* @param date 日期
|
|
268
|
+
*/
|
|
269
|
+
declare const getFirstDayOfWeek: (date?: string | number | Date | Dayjs) => Dayjs;
|
|
270
|
+
/**
|
|
271
|
+
* 获取本周最后一天(周日)
|
|
272
|
+
* @param date 日期
|
|
273
|
+
*/
|
|
274
|
+
declare const getLastDayOfWeek: (date?: string | number | Date | Dayjs) => Dayjs;
|
|
275
|
+
/**
|
|
276
|
+
* 获取本月第一天(Dayjs 对象)
|
|
277
|
+
* @param date 日期
|
|
278
|
+
*/
|
|
279
|
+
declare const getFirstDayOfMonthDate: (date?: string | number | Date | Dayjs) => Dayjs;
|
|
280
|
+
/**
|
|
281
|
+
* 获取本月最后一天(Dayjs 对象)
|
|
282
|
+
* @param date 日期
|
|
283
|
+
*/
|
|
284
|
+
declare const getLastDayOfMonthDate: (date?: string | number | Date | Dayjs) => Dayjs;
|
|
285
|
+
/**
|
|
286
|
+
* 获取本年第一天
|
|
287
|
+
* @param date 日期
|
|
288
|
+
*/
|
|
289
|
+
declare const getFirstDayOfYear: (date?: string | number | Date | Dayjs) => Dayjs;
|
|
290
|
+
/**
|
|
291
|
+
* 获取本年最后一天
|
|
292
|
+
* @param date 日期
|
|
293
|
+
*/
|
|
294
|
+
declare const getLastDayOfYear: (date?: string | number | Date | Dayjs) => Dayjs;
|
|
295
|
+
/**
|
|
296
|
+
* 判断日期是否相同
|
|
297
|
+
* @param date1 日期1
|
|
298
|
+
* @param date2 日期2
|
|
299
|
+
* @param unit 单位
|
|
300
|
+
*/
|
|
301
|
+
declare const isSame: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs, unit?: "year" | "month" | "day" | "hour" | "minute" | "second") => boolean;
|
|
302
|
+
/**
|
|
303
|
+
* 比较两个日期
|
|
304
|
+
* @param date1 日期1
|
|
305
|
+
* @param date2 日期2
|
|
306
|
+
* @returns 1(date1 > date2)、-1(date1 < date2)、0(date1 = date2)
|
|
307
|
+
*/
|
|
308
|
+
declare const compare: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => number;
|
|
309
|
+
/**
|
|
310
|
+
* 判断日期是否相同或在之前
|
|
311
|
+
* @param date1 日期1
|
|
312
|
+
* @param date2 日期2
|
|
313
|
+
*/
|
|
314
|
+
declare const isSameOrBefore: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => boolean;
|
|
315
|
+
/**
|
|
316
|
+
* 判断日期是否相同或在之后
|
|
317
|
+
* @param date1 日期1
|
|
318
|
+
* @param date2 日期2
|
|
319
|
+
*/
|
|
320
|
+
declare const isSameOrAfter: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => boolean;
|
|
321
|
+
/**
|
|
322
|
+
* 判断日期1是否在日期2之前
|
|
323
|
+
* @param date1 日期1
|
|
324
|
+
* @param date2 日期2
|
|
325
|
+
*/
|
|
326
|
+
declare const isBefore: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => boolean;
|
|
327
|
+
/**
|
|
328
|
+
* 判断日期1是否在日期2之后
|
|
329
|
+
* @param date1 日期1
|
|
330
|
+
* @param date2 日期2
|
|
331
|
+
*/
|
|
332
|
+
declare const isAfter: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => boolean;
|
|
333
|
+
/**
|
|
334
|
+
* 计算年龄
|
|
335
|
+
* @param birthday 生日
|
|
336
|
+
*/
|
|
337
|
+
declare const getAge: (birthday: string | number | Date | Dayjs) => number;
|
|
338
|
+
/**
|
|
339
|
+
* 判断是否是工作日(周一到周五)
|
|
340
|
+
* @param date 日期
|
|
341
|
+
*/
|
|
342
|
+
declare const isWorkday: (date?: string | number | Date | Dayjs) => boolean;
|
|
343
|
+
/**
|
|
344
|
+
* 判断是否是周末(周六或周日)
|
|
345
|
+
* @param date 日期
|
|
346
|
+
*/
|
|
347
|
+
declare const isWeekend: (date?: string | number | Date | Dayjs) => boolean;
|
|
348
|
+
/**
|
|
349
|
+
* 判断时间段(上午/下午/晚上/深夜)
|
|
350
|
+
* @param date 日期
|
|
351
|
+
*/
|
|
352
|
+
declare const getTimeOfDay: (date?: string | number | Date | Dayjs) => "morning" | "noon" | "afternoon" | "evening" | "night";
|
|
353
|
+
/**
|
|
354
|
+
* 获取时间段的中文名称
|
|
355
|
+
* @param date 日期
|
|
356
|
+
*/
|
|
357
|
+
declare const getTimeOfDayName: (date?: string | number | Date | Dayjs) => string;
|
|
358
|
+
/**
|
|
359
|
+
* 计算两个日期之间的工作日天数
|
|
360
|
+
* @param startDate 开始日期
|
|
361
|
+
* @param endDate 结束日期
|
|
362
|
+
*/
|
|
363
|
+
declare const getWorkdaysBetween: (startDate: string | number | Date | Dayjs, endDate: string | number | Date | Dayjs) => number;
|
|
364
|
+
/**
|
|
365
|
+
* 生成日期范围数组
|
|
366
|
+
* @param startDate 开始日期
|
|
367
|
+
* @param endDate 结束日期
|
|
368
|
+
* @param unit 单位(默认为天)
|
|
369
|
+
*/
|
|
370
|
+
declare const getDateRange: (startDate: string | number | Date | Dayjs, endDate: string | number | Date | Dayjs, unit?: TimeUnit) => Dayjs[];
|
|
371
|
+
/**
|
|
372
|
+
* 获取最近N天的日期数组
|
|
373
|
+
* @param days 天数
|
|
374
|
+
*/
|
|
375
|
+
declare const getRecentDays: (days: number) => Dayjs[];
|
|
376
|
+
/**
|
|
377
|
+
* 获取最近N个月的日期数组
|
|
378
|
+
* @param months 月数
|
|
379
|
+
*/
|
|
380
|
+
declare const getRecentMonths: (months: number) => Dayjs[];
|
|
381
|
+
/**
|
|
382
|
+
* 获取最近N周的日期数组
|
|
383
|
+
* @param weeks 周数
|
|
384
|
+
*/
|
|
385
|
+
declare const getRecentWeeks: (weeks: number) => Dayjs[];
|
|
386
|
+
/**
|
|
387
|
+
* 转换为 UTC 时间
|
|
388
|
+
* @param date 日期
|
|
389
|
+
*/
|
|
390
|
+
declare const toUTC: (date: string | number | Date | Dayjs) => Dayjs;
|
|
391
|
+
/**
|
|
392
|
+
* 从 UTC 转换为本地时间
|
|
393
|
+
* @param date 日期
|
|
394
|
+
*/
|
|
395
|
+
declare const fromUTC: (date: string | number | Date | Dayjs) => Dayjs;
|
|
396
|
+
/**
|
|
397
|
+
* 转换为指定时区的时间
|
|
398
|
+
* @param date 日期
|
|
399
|
+
* @param timezone 时区(如 'Asia/Shanghai')
|
|
400
|
+
*/
|
|
401
|
+
declare const toTimezone: (date: string | number | Date | Dayjs, timezone: string) => Dayjs;
|
|
402
|
+
/**
|
|
403
|
+
* 获取时区偏移量(分钟)
|
|
404
|
+
* @param date 日期
|
|
405
|
+
*/
|
|
406
|
+
declare const getTimezoneOffset: (date?: string | number | Date | Dayjs) => number;
|
|
407
|
+
/**
|
|
408
|
+
* 格式化持续时间
|
|
409
|
+
* @param milliseconds 毫秒数
|
|
410
|
+
*/
|
|
411
|
+
declare const formatDuration: (milliseconds: number) => string;
|
|
412
|
+
/**
|
|
413
|
+
* 获取最小日期
|
|
414
|
+
* @param dates 日期数组
|
|
415
|
+
*/
|
|
416
|
+
declare const minDate: (dates: Array<string | number | Date | Dayjs>) => Dayjs;
|
|
417
|
+
/**
|
|
418
|
+
* 获取最大日期
|
|
419
|
+
* @param dates 日期数组
|
|
420
|
+
*/
|
|
421
|
+
declare const maxDate: (dates: Array<string | number | Date | Dayjs>) => Dayjs;
|
|
422
|
+
/**
|
|
423
|
+
* 判断是否是本月
|
|
424
|
+
* @param date 日期
|
|
425
|
+
*/
|
|
426
|
+
declare const isThisMonth: (date: string | number | Date | Dayjs) => boolean;
|
|
427
|
+
/**
|
|
428
|
+
* 判断是否是本年
|
|
429
|
+
* @param date 日期
|
|
430
|
+
*/
|
|
431
|
+
declare const isThisYear: (date: string | number | Date | Dayjs) => boolean;
|
|
432
|
+
/**
|
|
433
|
+
* 判断是否是本周
|
|
434
|
+
* @param date 日期
|
|
435
|
+
*/
|
|
436
|
+
declare const isThisWeek: (date: string | number | Date | Dayjs) => boolean;
|
|
437
|
+
/**
|
|
438
|
+
* 判断是否是同月
|
|
439
|
+
* @param date1 日期1
|
|
440
|
+
* @param date2 日期2
|
|
441
|
+
*/
|
|
442
|
+
declare const isSameMonth: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => boolean;
|
|
443
|
+
/**
|
|
444
|
+
* 判断是否是同一年
|
|
445
|
+
* @param date1 日期1
|
|
446
|
+
* @param date2 日期2
|
|
447
|
+
*/
|
|
448
|
+
declare const isSameYear: (date1: string | number | Date | Dayjs, date2: string | number | Date | Dayjs) => boolean;
|
|
449
|
+
/**
|
|
450
|
+
* 获取农历年份(简化版,仅供参考)
|
|
451
|
+
* @param date 日期
|
|
452
|
+
*/
|
|
453
|
+
declare const getChineseYear: (date?: string | number | Date | Dayjs) => string;
|
|
454
|
+
/**
|
|
455
|
+
* 获取星座
|
|
456
|
+
* @param date 日期
|
|
457
|
+
*/
|
|
458
|
+
declare const getZodiacSign: (date?: string | number | Date | Dayjs) => string;
|
|
459
|
+
/**
|
|
460
|
+
* 判断是否是节日(简化版,仅支持主要节日)
|
|
461
|
+
* @param date 日期
|
|
462
|
+
*/
|
|
463
|
+
declare const isHoliday: (date?: string | number | Date | Dayjs) => boolean;
|
|
464
|
+
/**
|
|
465
|
+
* 获取节日名称(简化版)
|
|
466
|
+
* @param date 日期
|
|
467
|
+
*/
|
|
468
|
+
declare const getHolidayName: (date?: string | number | Date | Dayjs) => string | null;
|
|
469
|
+
/**
|
|
470
|
+
* 解析字符串为日期
|
|
471
|
+
* @param dateString 日期字符串
|
|
472
|
+
* @param formatStr 格式
|
|
473
|
+
*/
|
|
474
|
+
declare const parse: (dateString: string, formatStr?: string) => Dayjs;
|
|
475
|
+
/**
|
|
476
|
+
* 格式化为相对时间(未来)
|
|
477
|
+
* @param date 日期
|
|
478
|
+
*/
|
|
479
|
+
declare const toNow: (date: string | number | Date | Dayjs) => string;
|
|
480
|
+
/**
|
|
481
|
+
* 克隆日期
|
|
482
|
+
* @param date 日期
|
|
483
|
+
*/
|
|
484
|
+
declare const clone: (date: string | number | Date | Dayjs) => Dayjs;
|
|
485
|
+
/**
|
|
486
|
+
* 获取 Unix 时间戳(秒)
|
|
487
|
+
* @param date 日期
|
|
488
|
+
*/
|
|
489
|
+
declare const unix: (date?: string | number | Date | Dayjs) => number;
|
|
490
|
+
/**
|
|
491
|
+
* 从 Unix 时间戳创建日期
|
|
492
|
+
* @param timestamp Unix 时间戳(秒)
|
|
493
|
+
*/
|
|
494
|
+
declare const fromUnix: (timestamp: number) => Dayjs;
|
|
495
|
+
/**
|
|
496
|
+
* 获取毫秒时间戳
|
|
497
|
+
* @param date 日期
|
|
498
|
+
*/
|
|
499
|
+
declare const valueOf: (date?: string | number | Date | Dayjs) => number;
|
|
500
|
+
|
|
501
|
+
type index_DateFormat = DateFormat;
|
|
502
|
+
declare const index_Dayjs: typeof Dayjs;
|
|
503
|
+
type index_TimeUnit = TimeUnit;
|
|
504
|
+
declare const index_add: typeof add;
|
|
505
|
+
declare const index_clone: typeof clone;
|
|
506
|
+
declare const index_compare: typeof compare;
|
|
507
|
+
declare const index_computeDate: typeof computeDate;
|
|
508
|
+
declare const index_dayjs: typeof dayjs;
|
|
509
|
+
declare const index_diff: typeof diff;
|
|
510
|
+
declare const index_diffDays: typeof diffDays;
|
|
511
|
+
declare const index_diffHours: typeof diffHours;
|
|
512
|
+
declare const index_endDate: typeof endDate;
|
|
513
|
+
declare const index_endOf: typeof endOf;
|
|
514
|
+
declare const index_format: typeof format;
|
|
515
|
+
declare const index_formatDuration: typeof formatDuration;
|
|
516
|
+
declare const index_formatTimestamp: typeof formatTimestamp;
|
|
517
|
+
declare const index_fromNow: typeof fromNow;
|
|
518
|
+
declare const index_fromUTC: typeof fromUTC;
|
|
519
|
+
declare const index_fromUnix: typeof fromUnix;
|
|
520
|
+
declare const index_getAge: typeof getAge;
|
|
521
|
+
declare const index_getChineseYear: typeof getChineseYear;
|
|
522
|
+
declare const index_getDate: typeof getDate;
|
|
523
|
+
declare const index_getDateRange: typeof getDateRange;
|
|
524
|
+
declare const index_getDay: typeof getDay;
|
|
525
|
+
declare const index_getDayOfYear: typeof getDayOfYear;
|
|
526
|
+
declare const index_getDaysInMonth: typeof getDaysInMonth;
|
|
527
|
+
declare const index_getFirstDayOfMonth: typeof getFirstDayOfMonth;
|
|
528
|
+
declare const index_getFirstDayOfMonthDate: typeof getFirstDayOfMonthDate;
|
|
529
|
+
declare const index_getFirstDayOfWeek: typeof getFirstDayOfWeek;
|
|
530
|
+
declare const index_getFirstDayOfYear: typeof getFirstDayOfYear;
|
|
531
|
+
declare const index_getHolidayName: typeof getHolidayName;
|
|
532
|
+
declare const index_getHour: typeof getHour;
|
|
533
|
+
declare const index_getLastDayOfMonth: typeof getLastDayOfMonth;
|
|
534
|
+
declare const index_getLastDayOfMonthDate: typeof getLastDayOfMonthDate;
|
|
535
|
+
declare const index_getLastDayOfWeek: typeof getLastDayOfWeek;
|
|
536
|
+
declare const index_getLastDayOfYear: typeof getLastDayOfYear;
|
|
537
|
+
declare const index_getMinute: typeof getMinute;
|
|
538
|
+
declare const index_getMonth: typeof getMonth;
|
|
539
|
+
declare const index_getMonthRange: typeof getMonthRange;
|
|
540
|
+
declare const index_getQuarter: typeof getQuarter;
|
|
541
|
+
declare const index_getQuarterRange: typeof getQuarterRange;
|
|
542
|
+
declare const index_getRangeDate: typeof getRangeDate;
|
|
543
|
+
declare const index_getRecentDays: typeof getRecentDays;
|
|
544
|
+
declare const index_getRecentMonths: typeof getRecentMonths;
|
|
545
|
+
declare const index_getRecentWeeks: typeof getRecentWeeks;
|
|
546
|
+
declare const index_getRelativeTime: typeof getRelativeTime;
|
|
547
|
+
declare const index_getSecond: typeof getSecond;
|
|
548
|
+
declare const index_getTime: typeof getTime;
|
|
549
|
+
declare const index_getTimeOfDay: typeof getTimeOfDay;
|
|
550
|
+
declare const index_getTimeOfDayName: typeof getTimeOfDayName;
|
|
551
|
+
declare const index_getTimestamp: typeof getTimestamp;
|
|
552
|
+
declare const index_getTimezoneOffset: typeof getTimezoneOffset;
|
|
553
|
+
declare const index_getWeek: typeof getWeek;
|
|
554
|
+
declare const index_getWeekRange: typeof getWeekRange;
|
|
555
|
+
declare const index_getWeekday: typeof getWeekday;
|
|
556
|
+
declare const index_getWeekdayName: typeof getWeekdayName;
|
|
557
|
+
declare const index_getWorkdaysBetween: typeof getWorkdaysBetween;
|
|
558
|
+
declare const index_getYear: typeof getYear;
|
|
559
|
+
declare const index_getYearRange: typeof getYearRange;
|
|
560
|
+
declare const index_getZodiacSign: typeof getZodiacSign;
|
|
561
|
+
declare const index_isAfter: typeof isAfter;
|
|
562
|
+
declare const index_isBefore: typeof isBefore;
|
|
563
|
+
declare const index_isBetween: typeof isBetween;
|
|
564
|
+
declare const index_isHoliday: typeof isHoliday;
|
|
565
|
+
declare const index_isLeapYear: typeof isLeapYear;
|
|
566
|
+
declare const index_isSame: typeof isSame;
|
|
567
|
+
declare const index_isSameMonth: typeof isSameMonth;
|
|
568
|
+
declare const index_isSameOrAfter: typeof isSameOrAfter;
|
|
569
|
+
declare const index_isSameOrBefore: typeof isSameOrBefore;
|
|
570
|
+
declare const index_isSameYear: typeof isSameYear;
|
|
571
|
+
declare const index_isThisMonth: typeof isThisMonth;
|
|
572
|
+
declare const index_isThisWeek: typeof isThisWeek;
|
|
573
|
+
declare const index_isThisYear: typeof isThisYear;
|
|
574
|
+
declare const index_isToday: typeof isToday;
|
|
575
|
+
declare const index_isTomorrow: typeof isTomorrow;
|
|
576
|
+
declare const index_isValid: typeof isValid;
|
|
577
|
+
declare const index_isWeekend: typeof isWeekend;
|
|
578
|
+
declare const index_isWorkday: typeof isWorkday;
|
|
579
|
+
declare const index_isYesterday: typeof isYesterday;
|
|
580
|
+
declare const index_maxDate: typeof maxDate;
|
|
581
|
+
declare const index_minDate: typeof minDate;
|
|
582
|
+
declare const index_now: typeof now;
|
|
583
|
+
declare const index_parse: typeof parse;
|
|
584
|
+
declare const index_startDate: typeof startDate;
|
|
585
|
+
declare const index_startOf: typeof startOf;
|
|
586
|
+
declare const index_subtract: typeof subtract;
|
|
587
|
+
declare const index_toNow: typeof toNow;
|
|
588
|
+
declare const index_toTimezone: typeof toTimezone;
|
|
589
|
+
declare const index_toUTC: typeof toUTC;
|
|
590
|
+
declare const index_unix: typeof unix;
|
|
591
|
+
declare const index_valueOf: typeof valueOf;
|
|
592
|
+
declare namespace index {
|
|
593
|
+
export { type index_DateFormat as DateFormat, index_Dayjs as Dayjs, type index_TimeUnit as TimeUnit, index_add as add, index_clone as clone, index_compare as compare, index_computeDate as computeDate, index_dayjs as dayjs, dayjs as default, index_diff as diff, index_diffDays as diffDays, index_diffHours as diffHours, index_endDate as endDate, index_endOf as endOf, index_format as format, index_formatDuration as formatDuration, index_formatTimestamp as formatTimestamp, index_fromNow as fromNow, index_fromUTC as fromUTC, index_fromUnix as fromUnix, index_getAge as getAge, index_getChineseYear as getChineseYear, index_getDate as getDate, index_getDateRange as getDateRange, index_getDay as getDay, index_getDayOfYear as getDayOfYear, index_getDaysInMonth as getDaysInMonth, index_getFirstDayOfMonth as getFirstDayOfMonth, index_getFirstDayOfMonthDate as getFirstDayOfMonthDate, index_getFirstDayOfWeek as getFirstDayOfWeek, index_getFirstDayOfYear as getFirstDayOfYear, index_getHolidayName as getHolidayName, index_getHour as getHour, index_getLastDayOfMonth as getLastDayOfMonth, index_getLastDayOfMonthDate as getLastDayOfMonthDate, index_getLastDayOfWeek as getLastDayOfWeek, index_getLastDayOfYear as getLastDayOfYear, index_getMinute as getMinute, index_getMonth as getMonth, index_getMonthRange as getMonthRange, index_getQuarter as getQuarter, index_getQuarterRange as getQuarterRange, index_getRangeDate as getRangeDate, index_getRecentDays as getRecentDays, index_getRecentMonths as getRecentMonths, index_getRecentWeeks as getRecentWeeks, index_getRelativeTime as getRelativeTime, index_getSecond as getSecond, index_getTime as getTime, index_getTimeOfDay as getTimeOfDay, index_getTimeOfDayName as getTimeOfDayName, index_getTimestamp as getTimestamp, index_getTimezoneOffset as getTimezoneOffset, index_getWeek as getWeek, index_getWeekRange as getWeekRange, index_getWeekday as getWeekday, index_getWeekdayName as getWeekdayName, index_getWorkdaysBetween as getWorkdaysBetween, index_getYear as getYear, index_getYearRange as getYearRange, index_getZodiacSign as getZodiacSign, index_isAfter as isAfter, index_isBefore as isBefore, index_isBetween as isBetween, index_isHoliday as isHoliday, index_isLeapYear as isLeapYear, index_isSame as isSame, index_isSameMonth as isSameMonth, index_isSameOrAfter as isSameOrAfter, index_isSameOrBefore as isSameOrBefore, index_isSameYear as isSameYear, index_isThisMonth as isThisMonth, index_isThisWeek as isThisWeek, index_isThisYear as isThisYear, index_isToday as isToday, index_isTomorrow as isTomorrow, index_isValid as isValid, index_isWeekend as isWeekend, index_isWorkday as isWorkday, index_isYesterday as isYesterday, index_maxDate as maxDate, index_minDate as minDate, index_now as now, index_parse as parse, index_startDate as startDate, index_startOf as startOf, index_subtract as subtract, index_toNow as toNow, index_toTimezone as toTimezone, index_toUTC as toUTC, index_unix as unix, index_valueOf as valueOf };
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export { getWeekday as $, getFirstDayOfYear as A, getHolidayName as B, getHour as C, type DateFormat as D, getLastDayOfMonth as E, getLastDayOfMonthDate as F, getLastDayOfWeek as G, getLastDayOfYear as H, getMinute as I, getMonth as J, getMonthRange as K, getQuarter as L, getQuarterRange as M, getRangeDate as N, getRecentDays as O, getRecentMonths as P, getRecentWeeks as Q, getRelativeTime as R, getSecond as S, type TimeUnit as T, getTime as U, getTimeOfDay as V, getTimeOfDayName as W, getTimestamp as X, getTimezoneOffset as Y, getWeek as Z, getWeekRange as _, add as a, getWeekdayName as a0, getWorkdaysBetween as a1, getYear as a2, getYearRange as a3, getZodiacSign as a4, isAfter as a5, isBefore as a6, isBetween as a7, isHoliday as a8, isLeapYear as a9, isSame as aa, isSameMonth as ab, isSameOrAfter as ac, isSameOrBefore as ad, isSameYear as ae, isThisMonth as af, isThisWeek as ag, isThisYear as ah, isToday as ai, isTomorrow as aj, isValid as ak, isWeekend as al, isWorkday as am, isYesterday as an, maxDate as ao, minDate as ap, now as aq, parse as ar, startDate as as, startOf as at, subtract as au, toNow as av, toTimezone as aw, toUTC as ax, unix as ay, valueOf as az, compare as b, clone as c, computeDate as d, diff as e, diffDays as f, diffHours as g, endDate as h, index as i, endOf as j, format as k, formatDuration as l, formatTimestamp as m, fromNow as n, fromUTC as o, fromUnix as p, getAge as q, getChineseYear as r, getDate as s, getDateRange as t, getDay as u, getDayOfYear as v, getDaysInMonth as w, getFirstDayOfMonth as x, getFirstDayOfMonthDate as y, getFirstDayOfWeek as z };
|