@base-web-kits/base-tools-ts 1.3.10 → 1.3.11
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/base-tools-ts.umd.global.js +5 -0
- package/dist/base-tools-ts.umd.global.js.map +1 -1
- package/dist/day/index.d.ts +11 -0
- package/dist/day/index.d.ts.map +1 -1
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -1
- package/dist/url/oss/index.d.ts +8 -10
- package/dist/url/oss/index.d.ts.map +1 -1
- package/package.json +39 -39
- package/src/ts/day/index.ts +15 -0
- package/src/ts/url/oss/index.ts +9 -11
package/dist/day/index.d.ts
CHANGED
|
@@ -36,6 +36,17 @@ type BaseTime = number | string | Date | dayjs.Dayjs | null | undefined;
|
|
|
36
36
|
* d.diff(t, 'year'); // 与t相差的年数
|
|
37
37
|
*/
|
|
38
38
|
export declare function toDayjs(t?: BaseTime, fmt?: dayjs.OptionType): dayjs.Dayjs;
|
|
39
|
+
/**
|
|
40
|
+
* 格式时间
|
|
41
|
+
* @param t 时间
|
|
42
|
+
* @param fmt 日期格式,默认 `YYYY-MM-DD HH:mm:ss`
|
|
43
|
+
* @returns 格式化后的日期字符串
|
|
44
|
+
* @example
|
|
45
|
+
* dateFormat(1765337596913) // "2025-12-10 11:33:16"
|
|
46
|
+
* dateFormat(1765337596913, 'YYYY-MM-DD HH:mm:ss.SSS') // "2025-12-10 11:33:16.913"
|
|
47
|
+
* dateFormat('2025-12-10 11:33:16', 'YYYY年MM月DD日') // "2025年12月10日"
|
|
48
|
+
*/
|
|
49
|
+
export declare function dateFormat(t?: BaseTime, fmt?: string): string;
|
|
39
50
|
/**
|
|
40
51
|
* 获取“前几天”的日期范围
|
|
41
52
|
* @param offset 正整数天数
|
package/dist/day/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/day/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,uBAAuB,CAAC;AAU/B,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,UAAU,eAmB3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASnE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;;;;EAgB7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;EAqBlD;AAED;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/day/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,uBAAuB,CAAC;AAU/B,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,UAAU,eAmB3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAwB,UAGnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAe,YASnE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM;;;;;;EAgB7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM;;;EAqBlD;AAED;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -99,6 +99,7 @@ __export(index_exports, {
|
|
|
99
99
|
createViewRandId: () => createViewRandId,
|
|
100
100
|
curry: () => curry,
|
|
101
101
|
curryRight: () => curryRight,
|
|
102
|
+
dateFormat: () => dateFormat,
|
|
102
103
|
dayjs: () => import_dayjs.default,
|
|
103
104
|
debounce: () => debounce,
|
|
104
105
|
deburr: () => deburr,
|
|
@@ -3350,6 +3351,10 @@ function toDayjs(t, fmt) {
|
|
|
3350
3351
|
}
|
|
3351
3352
|
return (0, import_dayjs.default)(t, fmt);
|
|
3352
3353
|
}
|
|
3354
|
+
function dateFormat(t, fmt = "YYYY-MM-DD HH:mm:ss") {
|
|
3355
|
+
if (!t) return "";
|
|
3356
|
+
return toDayjs(t).format(fmt);
|
|
3357
|
+
}
|
|
3353
3358
|
function getDateRangeBefore(offset, fmt = "YYYY-MM-DD") {
|
|
3354
3359
|
const now = toDayjs(Date.now());
|
|
3355
3360
|
const n = Math.max(0, Math.trunc(offset));
|
|
@@ -4262,6 +4267,7 @@ function isLongitude(s) {
|
|
|
4262
4267
|
createViewRandId,
|
|
4263
4268
|
curry,
|
|
4264
4269
|
curryRight,
|
|
4270
|
+
dateFormat,
|
|
4265
4271
|
dayjs,
|
|
4266
4272
|
debounce,
|
|
4267
4273
|
deburr,
|