zhl-methods 1.1.7 → 1.1.8
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/js/ScanUDI.js +23 -19
- package/package.json +1 -1
package/js/ScanUDI.js
CHANGED
|
@@ -88,29 +88,33 @@ export default class ScanUDI {
|
|
|
88
88
|
}
|
|
89
89
|
setDateFormat(date, type, expand) {
|
|
90
90
|
try {
|
|
91
|
-
if (date
|
|
92
|
-
if (
|
|
93
|
-
|
|
91
|
+
if (date) {
|
|
92
|
+
if (date.length === 8 && data.substr(data.length - 2) == "00") {
|
|
93
|
+
if (type === "expiry") {
|
|
94
|
+
date = dayjs(date).endOf("month");
|
|
95
|
+
}
|
|
96
|
+
date = dayjs(date).startOf("month");
|
|
94
97
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
date = "20" + date;
|
|
98
|
+
if (date.length === 6) {
|
|
99
|
+
if (date.substring(0, 2) === expand.substring(0, 2)) {
|
|
100
|
+
// 年月(6位) - 202507
|
|
101
|
+
date = date + "01";
|
|
102
|
+
} else {
|
|
103
|
+
// 年后两位月日(6位) - 250708
|
|
104
|
+
date = "20" + date;
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
// 年后两位月(4位) - 2507
|
|
108
|
+
if (date.length === 4) {
|
|
109
|
+
if (type === "expiry") {
|
|
110
|
+
date = dayjs("20" + date).endOf("month");
|
|
111
|
+
}
|
|
112
|
+
date = "20" + date + "01";
|
|
110
113
|
}
|
|
111
|
-
|
|
114
|
+
return dayjs(date).format("YYYY-MM-DD");
|
|
115
|
+
} else {
|
|
116
|
+
return "";
|
|
112
117
|
}
|
|
113
|
-
return dayjs(date).format("YYYY-MM-DD");
|
|
114
118
|
} catch (error) {
|
|
115
119
|
console.log(error, "setDateFormat error");
|
|
116
120
|
return date;
|