@finema/core 1.3.16 → 1.3.18
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/utils/TimeHelper.mjs +11 -11
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
2
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
3
3
|
import utc from "dayjs/plugin/utc";
|
|
4
4
|
import duration from "dayjs/plugin/duration";
|
|
@@ -16,7 +16,7 @@ export class TimeHelper {
|
|
|
16
16
|
return time;
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const newTime = dayjs
|
|
19
|
+
const newTime = dayjs(time).subtract(7, "hour").format(dateTimeFormat);
|
|
20
20
|
return timeWrapper(newTime, time);
|
|
21
21
|
} catch (e) {
|
|
22
22
|
return time.toString();
|
|
@@ -27,57 +27,57 @@ export class TimeHelper {
|
|
|
27
27
|
return time;
|
|
28
28
|
}
|
|
29
29
|
try {
|
|
30
|
-
const newTime = dayjs
|
|
30
|
+
const newTime = dayjs(time).add(7, "hour").format(dateTimeFormat);
|
|
31
31
|
return timeWrapper(newTime, time);
|
|
32
32
|
} catch (e) {
|
|
33
33
|
return time;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
static getCurrentDate = () => {
|
|
37
|
-
const newTime = dayjs
|
|
37
|
+
const newTime = dayjs().format(dateFormat);
|
|
38
38
|
return timeWrapper(newTime, "");
|
|
39
39
|
};
|
|
40
40
|
static getDateFormTime = (time) => {
|
|
41
41
|
if (!time) {
|
|
42
42
|
return time;
|
|
43
43
|
}
|
|
44
|
-
const newTime = dayjs
|
|
44
|
+
const newTime = dayjs(time).format(dateFormat);
|
|
45
45
|
return timeWrapper(newTime, time);
|
|
46
46
|
};
|
|
47
47
|
static getDateFormTimeWithLocal = (time) => {
|
|
48
48
|
if (!time) {
|
|
49
49
|
return time;
|
|
50
50
|
}
|
|
51
|
-
const newTime = dayjs
|
|
51
|
+
const newTime = dayjs(TimeHelper.toLocal(time)).format(dateFormat);
|
|
52
52
|
return timeWrapper(newTime, time);
|
|
53
53
|
};
|
|
54
54
|
static getISODateTimeFormTime = (time) => {
|
|
55
55
|
if (!time) {
|
|
56
56
|
return time;
|
|
57
57
|
}
|
|
58
|
-
const testTime = dayjs
|
|
58
|
+
const testTime = dayjs(time).format(dateTimeFormat);
|
|
59
59
|
if (isTimeError(testTime)) {
|
|
60
60
|
return time;
|
|
61
61
|
}
|
|
62
|
-
const newTime = dayjs
|
|
62
|
+
const newTime = dayjs(time).toISOString();
|
|
63
63
|
return isTimeError(newTime) || !newTime ? time : newTime;
|
|
64
64
|
};
|
|
65
65
|
static getDateTimeFormTime = (time) => {
|
|
66
66
|
if (!time) {
|
|
67
67
|
return time;
|
|
68
68
|
}
|
|
69
|
-
const newTime = dayjs
|
|
69
|
+
const newTime = dayjs(time).format(dateTimeFormat);
|
|
70
70
|
return timeWrapper(newTime, time);
|
|
71
71
|
};
|
|
72
72
|
static getTimeFormTime = (time) => {
|
|
73
73
|
if (!time) {
|
|
74
74
|
return time;
|
|
75
75
|
}
|
|
76
|
-
const newTime = dayjs
|
|
76
|
+
const newTime = dayjs(time).format(timeFormat);
|
|
77
77
|
return timeWrapper(newTime, time);
|
|
78
78
|
};
|
|
79
79
|
static getCurrentDateTime = () => {
|
|
80
|
-
const newTime = dayjs
|
|
80
|
+
const newTime = dayjs().format(dateTimeFormat);
|
|
81
81
|
return timeWrapper(newTime, "");
|
|
82
82
|
};
|
|
83
83
|
}
|