使用 momentjs 检查两天内以及同一天内的时间
给定以下两个没有日期且使用时刻的时间,我如何才能根据 24 小时时间最好地检查以下两个场景:
1)
let startTime = "22:00:00";
let endTime = "02:00:00";
使用 startTime
我需要设置一些标志(布尔值)来指示endTime
已跨越到第二天,并且不在 startTime
的同一 24 小时内?
2)
let startTime = "22:00:00";
let endTime = "23:53:00";
与第 (1) 项相同,但这次设置一个标志,指示 startTime
和 endTime
在同一 24 小时内
Given the following two times without dates and using moment, how can I best check the following two scenarios based on 24 hours times:
1)
let startTime = "22:00:00";
let endTime = "02:00:00";
Using the startTime
I need to set some flag (boolean) indicating that the endTime
has spanned over to the next day and not within the same 24 hour period of the startTime
?
2)
let startTime = "22:00:00";
let endTime = "23:53:00";
the same as item (1) but this time setting a flag indicating that the startTime
and endTime
are within the same 24 hour period
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个片段。冒昧地将
let
替换为const
,因为变量没有预期的修改。Here's a snippet. Took the liberty to replace
let
byconst
, as there are no expected modifications to the variables.