@yoooloo42/bean 1.0.31 → 1.0.33

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/dist/index.esm.js CHANGED
@@ -4143,13 +4143,32 @@ var gbt3304 = [
4143
4143
  {"code": "56", "text": "基诺族"},
4144
4144
  ];
4145
4145
 
4146
+ // 引用标准:GB/T 3304
4147
+ var gbt4658 = [
4148
+ {"code": "01", "text": "博士研究生毕业"},
4149
+ {"code": "02", "text": "博士研究生结业"},
4150
+ {"code": "11", "text": "硕士研究生毕业"},
4151
+ {"code": "12", "text": "硕士研究生结业"},
4152
+ {"code": "21", "text": "大学本科毕业"},
4153
+ {"code": "28", "text": "大学本科肄业"},
4154
+ {"code": "31", "text": "大学专科毕业"},
4155
+ {"code": "41", "text": "中等专科毕业"},
4156
+ {"code": "44", "text": "职业高中毕业"},
4157
+ {"code": "47", "text": "技工学校毕业"},
4158
+ {"code": "61", "text": "普通高中毕业"},
4159
+ {"code": "71", "text": "初中毕业"},
4160
+ {"code": "81", "text": "小学毕业"},
4161
+ {"code": "90", "text": "其他(文盲、半文盲或未说明)"}
4162
+ ];
4163
+
4146
4164
  var GBT = {
4147
4165
  gbt2260code2,
4148
4166
  gbt2260code4,
4149
4167
  gbt2260code6,
4150
4168
  gbt2261,
4151
4169
  gbt2659,
4152
- gbt3304
4170
+ gbt3304,
4171
+ gbt4658
4153
4172
  };
4154
4173
 
4155
4174
  /**
@@ -4160,6 +4179,12 @@ var GBT = {
4160
4179
  * @returns {string} 格式化后的日期字符串
4161
4180
  */
4162
4181
  function dateFormat$1(date, format) {
4182
+ let result = '';
4183
+ if(!date){
4184
+ return ''
4185
+ }
4186
+ const format0 = format || 'yyyy/MM/dd HH:mm:ss';
4187
+
4163
4188
  // 有效的 Date 对象一致性
4164
4189
  const Date0 = new Date(date);
4165
4190
 
@@ -4175,27 +4200,27 @@ function dateFormat$1(date, format) {
4175
4200
  };
4176
4201
 
4177
4202
  // 替换年份 'yyyy'
4178
- if (/(y+)/.test(format)) {
4179
- format = format.replace(RegExp.$1, (Date0.getFullYear() + "").substr(4 - RegExp.$1.length));
4203
+ if (/(y+)/.test(format0)) {
4204
+ result = format0.replace(RegExp.$1, (Date0.getFullYear() + "").substr(4 - RegExp.$1.length));
4180
4205
  }
4181
4206
 
4182
4207
  // 替换 'AM/PM'
4183
- if (/(A|a)/.test(format)) {
4208
+ if (/(A|a)/.test(format0)) {
4184
4209
  const ampm = Date0.getHours() < 12 ? 'AM' : 'PM';
4185
- format = format.replace(RegExp.$1, RegExp.$1 === 'a' ? ampm.toLowerCase() : ampm);
4210
+ result = format0.replace(RegExp.$1, RegExp.$1 === 'a' ? ampm.toLowerCase() : ampm);
4186
4211
  }
4187
4212
 
4188
4213
  // 替换其他时间单位 'MM', 'dd', 'HH' 等
4189
4214
  for (let k in o) {
4190
- if (new RegExp("(" + k + ")").test(format)) {
4215
+ if (new RegExp("(" + k + ")").test(format0)) {
4191
4216
  const value = o[k];
4192
4217
  // $1 匹配到的字符串,例如 'MM'
4193
4218
  // 如果是毫秒 'S',则不补零
4194
- format = format.replace(RegExp.$1, (RegExp.$1.length === 1) ? (value) : (("00" + value).substr(("" + value).length)));
4219
+ result = format0.replace(RegExp.$1, (RegExp.$1.length === 1) ? (value) : (("00" + value).substr(("" + value).length)));
4195
4220
  }
4196
4221
  }
4197
4222
 
4198
- return format;
4223
+ return result;
4199
4224
  }
4200
4225
 
4201
4226
  /**