@yoooloo42/bean 1.0.37 → 1.0.39

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
@@ -4204,18 +4204,16 @@ function days$1({
4204
4204
  timepoint2_hours = 18, // 第二时点
4205
4205
  timepoint2_minutes = 0
4206
4206
  }){
4207
+ let checkin0 = new Date(checkin),
4208
+ checkout0 = new Date(checkout);
4207
4209
  let count = 0; // 计算天数(计价单位数)
4208
4210
 
4209
4211
  //时段错误
4210
- if (checkout <= checkin){
4212
+ if (checkout0 <= checkin0){
4211
4213
  return 1; // 至少计价1天(1个计价单位)
4212
4214
  }
4213
4215
 
4214
4216
  if (method_code === "0"){ // 日结
4215
- //结算时点
4216
- let checkin0 = new Date(checkin.toDateString()),
4217
- checkout0 = new Date(checkout.toDateString());
4218
-
4219
4217
  if (checkin0 === checkout0){ // 当日不考虑结算时点
4220
4218
  return 1;
4221
4219
  }
@@ -4226,25 +4224,25 @@ function days$1({
4226
4224
  // 半天计价
4227
4225
  if (
4228
4226
  (
4229
- (checkout.getHours() > timepoint_hours) ||
4227
+ (checkout0.getHours() > timepoint_hours) ||
4230
4228
  (
4231
- checkout.getHours() === timepoint_hours &&
4232
- checkout.getMinutes() > timepoint_minutes
4229
+ checkout0.getHours() === timepoint_hours &&
4230
+ checkout0.getMinutes() > timepoint_minutes
4233
4231
  )
4234
4232
  ) && (
4235
- (checkout.getHours() <= timepoint2_hours) ||
4233
+ (checkout0.getHours() <= timepoint2_hours) ||
4236
4234
  (
4237
- checkout.getHours() === timepoint2_hours &&
4238
- checkout.getMinutes() <= timepoint2_minutes
4235
+ checkout0.getHours() === timepoint2_hours &&
4236
+ checkout0.getMinutes() <= timepoint2_minutes
4239
4237
  )
4240
4238
  )
4241
4239
  ){
4242
4240
  count = count + 0.5;
4243
4241
  }else if(
4244
- (checkout.getHours() > timepoint2_hours) ||
4242
+ (checkout0.getHours() > timepoint2_hours) ||
4245
4243
  (
4246
- checkout.getHours() === timepoint2_hours &&
4247
- checkout.getMinutes() > timepoint2_minutes
4244
+ checkout0.getHours() === timepoint2_hours &&
4245
+ checkout0.getMinutes() > timepoint2_minutes
4248
4246
  )
4249
4247
  ){
4250
4248
  count = count + 1;
@@ -4253,13 +4251,13 @@ function days$1({
4253
4251
  // 至少 1 天
4254
4252
  count = (count < 1) ? 1 : count;
4255
4253
  }else if(method_code === "1"){ // 小时
4256
- count = Math.round((checkout - checkin) / (1000 * 60 * 60)); // 小时数
4254
+ count = Math.round((checkout0 - checkin0) / (1000 * 60 * 60)); // 小时数
4257
4255
  count = (count <= 0) ? 1 : count; // 至少 1 小时
4258
4256
  }else if(method_code === "2"){ // 月结
4259
- let c = (checkout.getFullYear() - checkin.getFullYear()) * 12,
4260
- c0 = (checkout.getMonth() >= checkin.getMonth())
4261
- ? (checkout.getMonth() - checkin.getMonth())
4262
- : (12 - checkin.getMonth + checkout.getMonth());
4257
+ let c = (checkout0.getFullYear() - checkin0.getFullYear()) * 12,
4258
+ c0 = (checkout0.getMonth() >= checkin0.getMonth())
4259
+ ? (checkout0.getMonth() - checkin0.getMonth())
4260
+ : (12 - checkin0.getMonth + checkout0.getMonth());
4263
4261
 
4264
4262
  count = c + c0 >= 1 ? c + c0 : 1; // 至少 1 个月
4265
4263
  }