@yoooloo42/joker 1.0.282 → 1.0.284

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
@@ -22218,80 +22218,78 @@ var WeChat = {
22218
22218
  /**
22219
22219
  * 将Date对象格式化为指定的字符串格式
22220
22220
  *
22221
- * @param {Date} date - 要格式化的日期对象
22222
- * @param {string} format - 目标格式字符串,例如:"yyyy年MM月dd日", "yyyy/MM/dd HH:mm:ss", "MM-dd HH:mm"
22221
+ * @param {Date} d - 要格式化的日期对象
22222
+ * @param {string} f - 目标格式字符串,例如:"yyyy年MM月dd日", "yyyy/MM/dd HH:mm:ss", "MM-dd HH:mm"
22223
22223
  * @returns {string} 格式化后的日期字符串
22224
22224
  */
22225
- function dateFormat$1(date, format) {
22226
- let result = '';
22227
- if(!date){
22228
- return ''
22229
- }
22230
- const format0 = format || 'yyyy/MM/dd HH:mm:ss';
22231
-
22232
- // 有效的 Date 对象一致性
22233
- const Date0 = new Date(date);
22234
-
22235
- const o = {
22236
- 'M+': Date0.getMonth() + 1, // 月份
22237
- 'd+': Date0.getDate(), // 日
22238
- 'h+': Date0.getHours() % 12 === 0 ? 12 : Date0.getHours() % 12, // 12小时制
22239
- 'H+': Date0.getHours(), // 24小时制
22240
- 'm+': Date0.getMinutes(), // 分
22241
- 's+': Date0.getSeconds(), // 秒
22242
- 'q+': Math.floor((Date0.getMonth() + 3) / 3), // 季度
22243
- 'S': Date0.getMilliseconds() // 毫秒
22244
- };
22225
+ function dateFormat$1(d, f){
22226
+ if(! d){ return "" }
22227
+ let d0 = new Date(d), d1 = "", f0 = f || "";
22245
22228
 
22246
- // 替换年份 'yyyy'
22247
- if (/(y+)/.test(format0)) {
22248
- result = format0.replace(RegExp.$1, (Date0.getFullYear() + "").substr(4 - RegExp.$1.length));
22249
- }
22250
-
22251
- // 替换 'AM/PM'
22252
- if (/(A|a)/.test(format0)) {
22253
- const ampm = Date0.getHours() < 12 ? 'AM' : 'PM';
22254
- result = format0.replace(RegExp.$1, RegExp.$1 === 'a' ? ampm.toLowerCase() : ampm);
22255
- }
22229
+ let year = d0.getFullYear();
22230
+ let year0 = "" + year;
22231
+ let month = d0.getMonth() + 1;
22232
+ let month0 = "" + month;
22233
+ let month1= month < 10 ? "0" + month0 : month0;
22234
+ let date = d0.getDate();
22235
+ let date0 = "" + date;
22236
+ let date1= date < 10 ? "0" + date0 : date0;
22237
+ let hours = d0.getHours();
22238
+ let hours0 = "" + hours;
22239
+ let hours1= hours < 10 ? "0" + hours0 : hours0;
22240
+ let minutes = d0.getMinutes();
22241
+ let minutes0 = "" + minutes;
22242
+ let minutes1= minutes < 10 ? "0" + minutes0 : minutes0;
22256
22243
 
22257
- // 替换其他时间单位 'MM', 'dd', 'HH' 等
22258
- for (let k in o) {
22259
- if (new RegExp("(" + k + ")").test(format0)) {
22260
- const value = o[k];
22261
- // $1 匹配到的字符串,例如 'MM'
22262
- // 如果是毫秒 'S',则不补零
22263
- result = format0.replace(RegExp.$1, (RegExp.$1.length === 1) ? (value) : (("00" + value).substr(("" + value).length)));
22264
- }
22244
+ switch(f0){
22245
+ case "yyyy年MM月dd日" :
22246
+ d1 = year0 + "" + month1 + "" + date1 + "日";
22247
+ break;
22248
+ case "yyyy年M月d日" :
22249
+ d1 = year0 + "年" + month0 + "月" + date0 + "日";
22250
+ break;
22251
+ case "yyyy-MM-dd" :
22252
+ d1 = year0 + "-" + month1 + "-" + date1;
22253
+ break;
22254
+ case "yyyy-M-d" :
22255
+ d1 = year0 + "-" + month0 + "-" + date0;
22256
+ break;
22257
+ case "yyyy/MM/dd" :
22258
+ d1 = year0 + "/" + month1 + "/" + date1;
22259
+ break;
22260
+ case "yyyy/M/d" :
22261
+ d1 = year0 + "/" + month0 + "/" + date0;
22262
+ break;
22263
+ case "yyyy/MM/dd HH:mm" :
22264
+ d1 = year0 + "/" + month1 + "/" + date1
22265
+ + " " + hours1 + ":" + minutes1;
22266
+ break;
22267
+ case "yyyy/M/d H:m" :
22268
+ d1 = year0 + "/" + month0 + "/" + date0
22269
+ + " " + hours0 + ":" + minutes0;
22270
+ break;
22271
+ default :
22272
+ d1 = year0 + "/" + month1 + "/" + date1
22273
+ + " " + hours1 + ":" + minutes1;
22265
22274
  }
22266
22275
 
22267
- return result;
22276
+ return d1;
22268
22277
  }
22269
22278
 
22270
22279
  /**
22271
22280
  * 计算两个日期之间相差的天数
22272
22281
  *
22273
- * @param {Date} dateFrom - 开始日期 (Date 对象)
22274
- * @param {Date} dateTo - 结束日期 (Date 对象)
22275
- * @returns {number | null} 相差的天数(向下取整)。如果日期无效,则返回 null。
22276
- * 结果为正数表示 dateTo 在 dateFrom 之后;负数表示 dateFrom 在 dateTo 之后。
22282
+ * @param {Date} dFrom - 开始日期 (Date 对象)
22283
+ * @param {Date} dTo - 截止日期 (Date 对象)
22284
+ * @returns {number} 相差的天数
22277
22285
  */
22278
- function days(dateFrom, dateTo) {
22279
- // 1. 有效的 Date 对象一致性
22280
- const DateFrom0 = new Date(dateFrom);
22281
- const DateTo0 = new Date(dateTo);
22282
-
22283
- // 2. 计算两个日期的时间戳差值 (毫秒)
22284
- // Date.getTime() 返回从 1970 1 1 00:00:00 UTC 至今的毫秒数
22285
- const timeDifference = DateTo0.getTime() - DateFrom0.getTime();
22286
-
22287
- // 3. 定义一天对应的毫秒数
22288
- const msPerDay = 1000 * 60 * 60 * 24;
22289
-
22290
- // 4. 将毫秒差值转换为天数
22291
- // Math.floor() 用于向下取整,确保得到完整的经过天数
22292
- const dayDifference = Math.floor(timeDifference / msPerDay);
22293
-
22294
- return dayDifference;
22286
+ function days(dFrom, dTo){
22287
+ let dFrom0 = new Date(new Date(dFrom).toDateString ());
22288
+ let dTo0 = new Date(new Date(dTo).toDateString ());
22289
+ if(dFrom0 >= dTo0){
22290
+ return 0
22291
+ }
22292
+ return Math.floor((dTo0 - dFrom0)/(1000 * 60 * 60 * 24)) + 1;
22295
22293
  }
22296
22294
  var dateFormat = {
22297
22295
  dateFormat: dateFormat$1,
@@ -23898,13 +23896,13 @@ return (_ctx, _cache) => {
23898
23896
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(propsItem_box).items, (item0, index0) => {
23899
23897
  return (vue.openBlock(), vue.createBlock(_component_el_radio, {
23900
23898
  key: index0,
23901
- label: item0[vue.unref(propsItem_box).item_fieldValue]
23899
+ value: item0[vue.unref(propsItem_box).item_fieldValue]
23902
23900
  }, {
23903
23901
  default: vue.withCtx(() => [
23904
23902
  vue.createTextVNode(vue.toDisplayString(item0[vue.unref(propsItem_box).item_fieldLabel]), 1 /* TEXT */)
23905
23903
  ]),
23906
23904
  _: 2 /* DYNAMIC */
23907
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["label"]))
23905
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["value"]))
23908
23906
  }), 128 /* KEYED_FRAGMENT */))
23909
23907
  ]),
23910
23908
  _: 1 /* STABLE */