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