mm_expand 1.6.2 → 1.6.4

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/index.js +11 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1040,7 +1040,7 @@ if (typeof($) === "undefined") {
1040
1040
  String.prototype.toTime = function() {
1041
1041
  var str = this;
1042
1042
  var time;
1043
- if (str.indexOf('T')) {
1043
+ if (str.indexOf('T') !== -1) {
1044
1044
  str = this.replace('T', ' ').replace('Z', '').replaceAll('-', '/');
1045
1045
  time = new Date(str).addSeconds(28800);
1046
1046
  }
@@ -1056,7 +1056,16 @@ if (typeof($) === "undefined") {
1056
1056
  * @return {String} 时间格式字符串
1057
1057
  */
1058
1058
  String.prototype.toTimeFormat = function(format) {
1059
- var str = this.replace('T', ' ').replace('Z', '').replaceAll('-', '/');
1059
+ var str = this;
1060
+ return str.toTime().toStr(format);
1061
+ };
1062
+ /**
1063
+ * @description 转为时间格式字符串
1064
+ * @param {String} format 转换的格式
1065
+ * @return {String} 时间格式字符串
1066
+ */
1067
+ String.prototype.toTimeStr = function(format) {
1068
+ var str = this;
1060
1069
  return str.toTime().toStr(format);
1061
1070
  };
1062
1071
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "这是超级美眉原型函数拓展模块,更有利于对string、array、object的操作,避免出错,简化业务逻辑。",
5
5
  "main": "index.js",
6
6
  "scripts": {