本文介绍了时刻比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var timeGraveyard = moment(itemT.ScreeningStart, 'LT');
var startTimeGraveyard = moment('12:00 AM', 'LT');
var endtimeGraveyard = moment('6:00 AM', 'LT');

if (timeGraveyard.isBetween(startTimeGraveyard, endtimeGraveyard)) {
    $('#lblGraveyard').text("Graveyard Schedule");
}





我的尝试:





What I have tried:

I want to limit the time between 12:00 AM and 6:00 AM

问题是它仍在执行if语句中的代码



timeGraveyard的样本输入:上午8:00

The problem is it still executing the code inside if statement

Sample input for timeGraveyard: 8:00 AM

推荐答案





我的尝试:





What I have tried:

I want to limit the time between 12:00 AM and 6:00 AM

问题是它仍在执行if语句中的代码



timeGraveyard的样本输入:上午8:00

The problem is it still executing the code inside if statement

Sample input for timeGraveyard: 8:00 AM


moment(timeGraveyard).isBetween(startTimeGraveyard, endtimeGraveyard))





欲了解更多详情,请参阅:

[ ]

[]


这篇关于时刻比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:38