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