【发布时间】:2021-06-18 08:08:39
【问题描述】:
我正在尝试检查时间是否介于两次之间或不使用片刻。我试过这样
import * as moment from 'moment';
current_day_time.current_time = 2021-06-18T08:03Z
batch_info.batch_start_time = 2021-06-17T03:30:29.351Z,
batch_info.batch_end_time = 2021-06-17T12:30:32.191Z
const current_time = moment(current_day_time.current_time);
const start = moment(batch_info.batch_start_time);
const end = moment(batch_info.batch_end_time);
current = Fri Jun 18 2021 13:32:00 GMT+0530
start = Thu Jun 17 2021 09:00:29 GMT+0530
end = Thu Jun 17 2021 18:00:32 GMT+0530
console.log(moment(current_time).isBetween(start, end)); // false
我们可以清楚地看到 9-18 之间有 13 个谎言,但我还是错了。我怎样才能只比较时间?
【问题讨论】:
-
Jun 18不属于Jun 17的两个日期之间。 -
我只是想比较一下时间@Mr_Green。
标签: javascript angular typescript momentjs