tools-min-ns 1.9.6 → 1.9.7
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/README.md +3 -0
- package/esm/date/DateUtil.d.ts +1 -1
- package/esm/date/DateUtil.js +4 -4
- package/lib/date/DateUtil.d.ts +1 -1
- package/lib/date/DateUtil.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/esm/date/DateUtil.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ declare namespace DateUtil {
|
|
|
114
114
|
* @param {Number} year 年份
|
|
115
115
|
* @param {Number} month 月份 (1-12)
|
|
116
116
|
* @example
|
|
117
|
-
* getDaysInMonth(2012,
|
|
117
|
+
* getDaysInMonth(2012,3) => 31
|
|
118
118
|
*/
|
|
119
119
|
const getDaysInMonth: (year: string | number, month: string | number) => number;
|
|
120
120
|
/**
|
package/esm/date/DateUtil.js
CHANGED
|
@@ -315,7 +315,7 @@ var DateUtil;
|
|
|
315
315
|
} else {
|
|
316
316
|
result.setMonth(result.getMonth() + (diff.month || 0));
|
|
317
317
|
}
|
|
318
|
-
result.setDate(Math.min(n, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth())));
|
|
318
|
+
result.setDate(Math.min(n, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth() + 1)));
|
|
319
319
|
// 处理 year
|
|
320
320
|
var m = result.getDate();
|
|
321
321
|
result.setDate(1);
|
|
@@ -324,7 +324,7 @@ var DateUtil;
|
|
|
324
324
|
} else {
|
|
325
325
|
result.setFullYear(result.getFullYear() + (diff.year || 0));
|
|
326
326
|
}
|
|
327
|
-
result.setDate(Math.min(m, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth())));
|
|
327
|
+
result.setDate(Math.min(m, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth() + 1)));
|
|
328
328
|
return result;
|
|
329
329
|
};
|
|
330
330
|
/**
|
|
@@ -346,7 +346,7 @@ var DateUtil;
|
|
|
346
346
|
* @param {Number} year 年份
|
|
347
347
|
* @param {Number} month 月份 (1-12)
|
|
348
348
|
* @example
|
|
349
|
-
* getDaysInMonth(2012,
|
|
349
|
+
* getDaysInMonth(2012,3) => 31
|
|
350
350
|
*/
|
|
351
351
|
DateUtil.getDaysInMonth = function (year, month) {
|
|
352
352
|
return [31, DateUtil.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][Number(month) - 1];
|
|
@@ -421,7 +421,7 @@ var DateUtil;
|
|
|
421
421
|
millsecond: 1
|
|
422
422
|
});
|
|
423
423
|
case 'MONTH':
|
|
424
|
-
return new Date(parts.Year, parts.Month, DateUtil.getDaysInMonth(parts.Year, parts.Month), 23, 59, 59, 999);
|
|
424
|
+
return new Date(parts.Year, parts.Month, DateUtil.getDaysInMonth(parts.Year, parts.Month + 1), 23, 59, 59, 999);
|
|
425
425
|
case 'WEEK':
|
|
426
426
|
var year = date.getFullYear();
|
|
427
427
|
var month = date.getMonth();
|
package/lib/date/DateUtil.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ declare namespace DateUtil {
|
|
|
114
114
|
* @param {Number} year 年份
|
|
115
115
|
* @param {Number} month 月份 (1-12)
|
|
116
116
|
* @example
|
|
117
|
-
* getDaysInMonth(2012,
|
|
117
|
+
* getDaysInMonth(2012,3) => 31
|
|
118
118
|
*/
|
|
119
119
|
const getDaysInMonth: (year: string | number, month: string | number) => number;
|
|
120
120
|
/**
|
package/lib/date/DateUtil.js
CHANGED
|
@@ -325,7 +325,7 @@ var DateUtil;
|
|
|
325
325
|
} else {
|
|
326
326
|
result.setMonth(result.getMonth() + (diff.month || 0));
|
|
327
327
|
}
|
|
328
|
-
result.setDate(Math.min(n, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth())));
|
|
328
|
+
result.setDate(Math.min(n, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth() + 1)));
|
|
329
329
|
// 处理 year
|
|
330
330
|
var m = result.getDate();
|
|
331
331
|
result.setDate(1);
|
|
@@ -334,7 +334,7 @@ var DateUtil;
|
|
|
334
334
|
} else {
|
|
335
335
|
result.setFullYear(result.getFullYear() + (diff.year || 0));
|
|
336
336
|
}
|
|
337
|
-
result.setDate(Math.min(m, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth())));
|
|
337
|
+
result.setDate(Math.min(m, DateUtil.getDaysInMonth(result.getFullYear(), result.getMonth() + 1)));
|
|
338
338
|
return result;
|
|
339
339
|
};
|
|
340
340
|
/**
|
|
@@ -356,7 +356,7 @@ var DateUtil;
|
|
|
356
356
|
* @param {Number} year 年份
|
|
357
357
|
* @param {Number} month 月份 (1-12)
|
|
358
358
|
* @example
|
|
359
|
-
* getDaysInMonth(2012,
|
|
359
|
+
* getDaysInMonth(2012,3) => 31
|
|
360
360
|
*/
|
|
361
361
|
DateUtil.getDaysInMonth = function (year, month) {
|
|
362
362
|
return [31, DateUtil.isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][Number(month) - 1];
|
|
@@ -431,7 +431,7 @@ var DateUtil;
|
|
|
431
431
|
millsecond: 1
|
|
432
432
|
});
|
|
433
433
|
case 'MONTH':
|
|
434
|
-
return new Date(parts.Year, parts.Month, DateUtil.getDaysInMonth(parts.Year, parts.Month), 23, 59, 59, 999);
|
|
434
|
+
return new Date(parts.Year, parts.Month, DateUtil.getDaysInMonth(parts.Year, parts.Month + 1), 23, 59, 59, 999);
|
|
435
435
|
case 'WEEK':
|
|
436
436
|
var year = date.getFullYear();
|
|
437
437
|
var month = date.getMonth();
|