zhl-methods 1.1.5 → 1.1.6
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 +7 -10
- package/package.json +1 -1
package/js/ScanUDI.js
CHANGED
|
@@ -126,31 +126,28 @@ export default class ScanUDI {
|
|
|
126
126
|
setDateFormat(date, type) {
|
|
127
127
|
if (date.length === 8 && data.substr(data.length - 2) == "00") {
|
|
128
128
|
if (type === "expiry") {
|
|
129
|
-
|
|
129
|
+
date = dayjs(date).endOf("month");
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
date = dayjs(date).startOf("month");
|
|
132
132
|
}
|
|
133
133
|
if (date.length === 6) {
|
|
134
134
|
// 年月(6位) - 202507
|
|
135
135
|
if (date.substring(0, 2) === "20") {
|
|
136
|
-
|
|
136
|
+
date = date + "01";
|
|
137
137
|
}
|
|
138
138
|
// 年后两位月日(6位) - 250708
|
|
139
139
|
if (date.substring(0, 2) !== "20") {
|
|
140
|
-
|
|
140
|
+
date = "20" + date;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
// 年后两位月(4位) - 2507
|
|
144
144
|
if (date.length === 4) {
|
|
145
145
|
if (type === "expiry") {
|
|
146
|
-
|
|
147
|
-
.endOf("month")
|
|
148
|
-
.format("YYYYMMDD");
|
|
146
|
+
date = dayjs("20" + date).endOf("month");
|
|
149
147
|
}
|
|
150
|
-
|
|
148
|
+
date = "20" + date + "01";
|
|
151
149
|
}
|
|
152
|
-
|
|
153
|
-
return date;
|
|
150
|
+
return dayjs(date).format("YYYY-MM-DD");
|
|
154
151
|
}
|
|
155
152
|
removeFrontZeros(str) {
|
|
156
153
|
try {
|