qmwts 1.1.27 → 1.1.28

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.
@@ -0,0 +1,2 @@
1
+ export default class LocalDateTime {
2
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var LocalDateTime = /** @class */ (function () {
4
+ function LocalDateTime() {
5
+ }
6
+ return LocalDateTime;
7
+ }());
8
+ exports.default = LocalDateTime;
@@ -0,0 +1,7 @@
1
+ export default class LocalDate {
2
+ private date;
3
+ constructor(...args: any[]);
4
+ static now: () => LocalDate;
5
+ static of: (year: any, month: any, date: any) => LocalDate;
6
+ toString: () => string;
7
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var number_utils_1 = require("../utils/number-utils");
4
+ var prototype_utils_1 = require("../utils/prototype-utils");
5
+ // https://juejin.cn/post/7098891689955164168
6
+ var LocalDate = /** @class */ (function () {
7
+ function LocalDate() {
8
+ var args = [];
9
+ for (var _i = 0; _i < arguments.length; _i++) {
10
+ args[_i] = arguments[_i];
11
+ }
12
+ var _this = this;
13
+ this.toString = function () {
14
+ return [
15
+ _this.date.getFullYear(),
16
+ number_utils_1.default.leftPadZero(_this.date.getMonth() + 1, 2),
17
+ number_utils_1.default.leftPadZero(_this.date.getDate(), 2)
18
+ ].join('-');
19
+ };
20
+ this.date = new Date();
21
+ if (number_utils_1.default.isNumber(args[0]))
22
+ this.date.setFullYear(+args[0]);
23
+ if (number_utils_1.default.isNumber(args[1]))
24
+ this.date.setMonth(+args[1] - 1);
25
+ if (number_utils_1.default.isNumber(args[2]))
26
+ this.date.setDate(args[2]);
27
+ if (prototype_utils_1.default.isDate(args[0]))
28
+ this.date = args[0];
29
+ }
30
+ LocalDate.now = function () {
31
+ return new LocalDate();
32
+ };
33
+ LocalDate.of = function (year, month, date) {
34
+ return new LocalDate(year, month, date);
35
+ };
36
+ return LocalDate;
37
+ }());
38
+ exports.default = LocalDate;
@@ -0,0 +1,7 @@
1
+ export default class YearMonth {
2
+ private date;
3
+ constructor(...args: any[]);
4
+ static now: () => YearMonth;
5
+ static of: (year: any, month: any) => YearMonth;
6
+ toString: () => string;
7
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var number_utils_1 = require("../utils/number-utils");
4
+ var prototype_utils_1 = require("../utils/prototype-utils");
5
+ var YearMonth = /** @class */ (function () {
6
+ function YearMonth() {
7
+ var args = [];
8
+ for (var _i = 0; _i < arguments.length; _i++) {
9
+ args[_i] = arguments[_i];
10
+ }
11
+ var _this = this;
12
+ this.toString = function () {
13
+ return [
14
+ _this.date.getFullYear(),
15
+ number_utils_1.default.leftPadZero(_this.date.getMonth() + 1, 2)
16
+ ].join('-');
17
+ };
18
+ this.date = new Date();
19
+ if (number_utils_1.default.isNumber(args[0]))
20
+ this.date.setFullYear(+args[0]);
21
+ if (number_utils_1.default.isNumber(args[1]))
22
+ this.date.setMonth(+args[1] - 1);
23
+ if (prototype_utils_1.default.isDate(args[0]))
24
+ this.date = args[0];
25
+ }
26
+ YearMonth.now = function () {
27
+ return new YearMonth();
28
+ };
29
+ YearMonth.of = function (year, month) {
30
+ return new YearMonth(year, month);
31
+ };
32
+ return YearMonth;
33
+ }());
34
+ exports.default = YearMonth;
package/dist/index.d.ts CHANGED
@@ -5,4 +5,8 @@ import UUIDUtils from './utils/uuid-utils';
5
5
  import PrototypeUtils from './utils/prototype-utils';
6
6
  import RequestDataGenerator from './utils/request-data-generator';
7
7
  import FileUtils from './utils/file-utils';
8
- export { Downloader, NumberUtils, JsonUtils, UUIDUtils, PrototypeUtils, RequestDataGenerator, FileUtils, };
8
+ import DateUtils from './utils/date-utils';
9
+ import LocalDate from './class/local-date';
10
+ import LocalDateTime from './class/local-date-time';
11
+ import YearMonth from './class/year-month';
12
+ export { Downloader, NumberUtils, JsonUtils, UUIDUtils, PrototypeUtils, RequestDataGenerator, FileUtils, DateUtils, LocalDate, LocalDateTime, YearMonth, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileUtils = exports.RequestDataGenerator = exports.PrototypeUtils = exports.UUIDUtils = exports.JsonUtils = exports.NumberUtils = exports.Downloader = void 0;
3
+ exports.YearMonth = exports.LocalDateTime = exports.LocalDate = exports.DateUtils = exports.FileUtils = exports.RequestDataGenerator = exports.PrototypeUtils = exports.UUIDUtils = exports.JsonUtils = exports.NumberUtils = exports.Downloader = void 0;
4
4
  // https://www.jianshu.com/p/8fa2c50720e4
5
5
  var downloader_1 = require("./utils/downloader");
6
6
  exports.Downloader = downloader_1.default;
@@ -16,3 +16,11 @@ var request_data_generator_1 = require("./utils/request-data-generator");
16
16
  exports.RequestDataGenerator = request_data_generator_1.default;
17
17
  var file_utils_1 = require("./utils/file-utils");
18
18
  exports.FileUtils = file_utils_1.default;
19
+ var date_utils_1 = require("./utils/date-utils");
20
+ exports.DateUtils = date_utils_1.default;
21
+ var local_date_1 = require("./class/local-date");
22
+ exports.LocalDate = local_date_1.default;
23
+ var local_date_time_1 = require("./class/local-date-time");
24
+ exports.LocalDateTime = local_date_time_1.default;
25
+ var year_month_1 = require("./class/year-month");
26
+ exports.YearMonth = year_month_1.default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ isToday(date: Date): boolean;
3
+ toDateString(date: Date): string;
4
+ toDateTimeString(date: Date): string;
5
+ };
6
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ isToday: function (date) {
5
+ var today = new Date();
6
+ return today.getFullYear() === date.getFullYear()
7
+ && today.getMonth() === date.getMonth()
8
+ && today.getDate() === date.getDate();
9
+ },
10
+ toDateString: function (date) {
11
+ return '';
12
+ },
13
+ toDateTimeString: function (date) {
14
+ return '';
15
+ }
16
+ };
@@ -3,5 +3,6 @@ declare const _default: {
3
3
  isNumber(...number: any[]): boolean;
4
4
  thousandths(number: any, fixed?: number): string;
5
5
  summation(array?: any[]): number;
6
+ leftPadZero(num: number, pad: number): string;
6
7
  };
7
8
  export default _default;
@@ -29,5 +29,8 @@ exports.default = {
29
29
  var _this = this;
30
30
  if (array === void 0) { array = []; }
31
31
  return array.reduce(function (prev, curr) { return prev + _this.ifNaN(curr, 0); }, 0);
32
+ },
33
+ leftPadZero: function (num, pad) {
34
+ return ('0' + num).slice(-pad);
32
35
  }
33
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qmwts",
3
- "version": "1.1.27",
3
+ "version": "1.1.28",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",