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.
Files changed (2) hide show
  1. package/js/ScanUDI.js +7 -10
  2. 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
- return dayjs(date).endOf("month").format("YYYYMMDD");
129
+ date = dayjs(date).endOf("month");
130
130
  }
131
- return dayjs(date).startOf("month").format("YYYYMMDD");
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
- return date + "01";
136
+ date = date + "01";
137
137
  }
138
138
  // 年后两位月日(6位) - 250708
139
139
  if (date.substring(0, 2) !== "20") {
140
- return "20" + date;
140
+ date = "20" + date;
141
141
  }
142
142
  }
143
143
  // 年后两位月(4位) - 2507
144
144
  if (date.length === 4) {
145
145
  if (type === "expiry") {
146
- return dayjs("20" + date)
147
- .endOf("month")
148
- .format("YYYYMMDD");
146
+ date = dayjs("20" + date).endOf("month");
149
147
  }
150
- return "20" + date + "01";
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhl-methods",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "license": "ISC",
5
5
  "dependencies": {
6
6
  "dayjs": "^1.11.15",