mm_expand 1.7.4 → 1.7.5

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 (3) hide show
  1. package/index.js +7 -11
  2. package/package.json +1 -1
  3. package/test.js +1 -1
package/index.js CHANGED
@@ -1108,23 +1108,19 @@ if (typeof($) === "undefined") {
1108
1108
  }
1109
1109
  };
1110
1110
  /**
1111
- * @description 转为时间对象
1112
- * @return {Date} 返回时间对象类型
1111
+ * @description Convert to time object
1112
+ * @return {Date} time object
1113
1113
  */
1114
1114
  String.prototype.toTime = function() {
1115
1115
  var str = this;
1116
1116
  var time;
1117
1117
  if (str.indexOf('T') !== -1) {
1118
- // str = this.replace('T', ' ').replaceAll('-', '/');
1119
- str = this.replace('T', ' ');
1120
- if (str.indexOf('Z') !== -1) {
1121
- str = str.replace('Z', '');
1122
- time = (new Date(str)).addSeconds(28800);
1123
- } else {
1124
- time = new Date(str);
1125
- }
1118
+ str = str.replace('T', ' ');
1119
+ }
1120
+ if (str.indexOf('Z') !== -1) {
1121
+ str = str.replace('Z', '');
1122
+ time = (new Date(str)).addSeconds(28800);
1126
1123
  } else {
1127
- // str = this.replaceAll('-', '/');
1128
1124
  time = new Date(str);
1129
1125
  }
1130
1126
  return time;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "这是超级美眉原型函数拓展模块,更有利于对string、array、object的操作,避免出错,简化业务逻辑。",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -8,7 +8,6 @@ require('./index.js');
8
8
  // console.log(t.toTimestamp());
9
9
  // console.log(t.toTimeStr('yyyy-MM-dd hh:mm:ss'));
10
10
  // console.log(t.toTimeStr('yyyy-MM-ddThh:mm:ssZ'));
11
-
12
11
  // var index = $.eventer.on('update_config', (conf) => {
13
12
  // console.log("事件示例", conf);
14
13
  // });
@@ -52,6 +51,7 @@ var time = now.toStr('yyyy-MM-dd hh:mm:ss');
52
51
  console.log("当前", time);
53
52
  console.log("时间", time.toTime().toStr("yyyy-MM-dd hh:mm:ss"));
54
53
  console.log("当前", new Date(time).toStr("yyyy-MM-dd hh:mm:ss"));
54
+ console.log(now.toString(), now.toString().toTime().toStr('yyyy-MM-dd hh:mm:ss'));
55
55
 
56
56
  // var time = now.toStr("yyyy-MM-ddThh:mm");
57
57
  // console.log("当前", time);