@fast-china/utils 1.0.34 → 1.0.35
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.global.js +65 -68
- package/dist/index.global.js.map +1 -1
- package/dist/index.global.min.js +1 -1
- package/dist/index.global.min.js.map +1 -1
- package/es/date/index.d.ts +1 -1
- package/es/date/index.mjs +1 -1
- package/es/date/index.mjs.map +1 -1
- package/lib/date/index.d.ts +1 -1
- package/lib/date/index.js +1 -1
- package/lib/date/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -13294,77 +13294,74 @@ var FastUtils = (function(exports, vue) {
|
|
|
13294
13294
|
* 时间处理翻译
|
|
13295
13295
|
*/
|
|
13296
13296
|
dateTimeFix(date2) {
|
|
13297
|
-
if (date2
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
}
|
|
13345
|
-
return "刚刚";
|
|
13346
|
-
}
|
|
13347
|
-
if (monthC > 12) {
|
|
13348
|
-
return `${parseInt(`${monthC / 12}`)}年前`;
|
|
13349
|
-
} else if (monthC >= 6) {
|
|
13350
|
-
return "半年前";
|
|
13351
|
-
} else if (monthC >= 1) {
|
|
13352
|
-
return `${parseInt(`${monthC}`)}月前`;
|
|
13353
|
-
} else if (weekC > 2) {
|
|
13354
|
-
return "半月前";
|
|
13355
|
-
} else if (weekC >= 1) {
|
|
13356
|
-
return `${parseInt(`${weekC}`)}周前`;
|
|
13357
|
-
} else if (dayC >= 1) {
|
|
13358
|
-
return `${parseInt(`${dayC}`)}天前`;
|
|
13359
|
-
} else if (hourC >= 1) {
|
|
13360
|
-
return `${parseInt(`${hourC}`)}小时前`;
|
|
13361
|
-
} else if (minC >= 1) {
|
|
13362
|
-
return `${parseInt(`${minC}`)}分钟前`;
|
|
13297
|
+
if (isNil(date2)) {
|
|
13298
|
+
return "";
|
|
13299
|
+
}
|
|
13300
|
+
let timestamp;
|
|
13301
|
+
if (typeof date2 === "string") {
|
|
13302
|
+
timestamp = new Date(date2).getTime();
|
|
13303
|
+
} else if (typeof date2 === "number") {
|
|
13304
|
+
timestamp = date2;
|
|
13305
|
+
} else {
|
|
13306
|
+
timestamp = date2.getTime();
|
|
13307
|
+
}
|
|
13308
|
+
if (timestamp < 1e12) {
|
|
13309
|
+
timestamp *= 1e3;
|
|
13310
|
+
}
|
|
13311
|
+
const minute = 1e3 * 60;
|
|
13312
|
+
const hour = minute * 60;
|
|
13313
|
+
const day = hour * 24;
|
|
13314
|
+
const month = day * 30;
|
|
13315
|
+
const curTime = (/* @__PURE__ */ new Date()).getTime();
|
|
13316
|
+
const diffValue = curTime - timestamp;
|
|
13317
|
+
const monthC = diffValue / month;
|
|
13318
|
+
const weekC = diffValue / (7 * day);
|
|
13319
|
+
const dayC = diffValue / day;
|
|
13320
|
+
const hourC = diffValue / hour;
|
|
13321
|
+
const minC = diffValue / minute;
|
|
13322
|
+
if (diffValue < 0) {
|
|
13323
|
+
const monthC1 = Math.abs(monthC);
|
|
13324
|
+
const weekC1 = Math.abs(weekC);
|
|
13325
|
+
const dayC1 = Math.abs(dayC);
|
|
13326
|
+
const hourC1 = Math.abs(hourC);
|
|
13327
|
+
const minC1 = Math.abs(minC);
|
|
13328
|
+
if (monthC1 > 12) {
|
|
13329
|
+
return `${Math.floor(monthC1 / 12)}年后`;
|
|
13330
|
+
} else if (monthC1 >= 6) {
|
|
13331
|
+
return "半年后";
|
|
13332
|
+
} else if (monthC1 >= 1) {
|
|
13333
|
+
return `${Math.floor(monthC1)}月后`;
|
|
13334
|
+
} else if (weekC1 > 2) {
|
|
13335
|
+
return "半月后";
|
|
13336
|
+
} else if (weekC1 >= 1) {
|
|
13337
|
+
return `${Math.floor(weekC1)}周后`;
|
|
13338
|
+
} else if (dayC1 >= 1) {
|
|
13339
|
+
return `${Math.floor(dayC1)}天后`;
|
|
13340
|
+
} else if (hourC1 >= 1) {
|
|
13341
|
+
return `${Math.floor(hourC1)}小时后`;
|
|
13342
|
+
} else if (minC1 >= 1) {
|
|
13343
|
+
return `${Math.floor(minC1)}分钟后`;
|
|
13363
13344
|
}
|
|
13364
13345
|
return "刚刚";
|
|
13365
|
-
} else {
|
|
13366
|
-
return "";
|
|
13367
13346
|
}
|
|
13347
|
+
if (monthC > 12) {
|
|
13348
|
+
return `${Math.floor(monthC / 12)}年前`;
|
|
13349
|
+
} else if (monthC >= 6) {
|
|
13350
|
+
return "半年前";
|
|
13351
|
+
} else if (monthC >= 1) {
|
|
13352
|
+
return `${Math.floor(monthC)}月前`;
|
|
13353
|
+
} else if (weekC > 2) {
|
|
13354
|
+
return "半月前";
|
|
13355
|
+
} else if (weekC >= 1) {
|
|
13356
|
+
return `${Math.floor(weekC)}周前`;
|
|
13357
|
+
} else if (dayC >= 1) {
|
|
13358
|
+
return `${Math.floor(dayC)}天前`;
|
|
13359
|
+
} else if (hourC >= 1) {
|
|
13360
|
+
return `${Math.floor(hourC)}小时前`;
|
|
13361
|
+
} else if (minC >= 1) {
|
|
13362
|
+
return `${Math.floor(minC)}分钟前`;
|
|
13363
|
+
}
|
|
13364
|
+
return "刚刚";
|
|
13368
13365
|
},
|
|
13369
13366
|
/**
|
|
13370
13367
|
* 获取默认时间
|