无论哪一天,如何获得两个小时范围内的时间

How to get time in range of two hours no matter which day?

本文关键字:两个 小时 范围内 时间 一天 何获得      更新时间:2023-09-26

>我正在使用momentjs及其插件时刻范围,无论哪一天,我都想获得两个小时范围内的时间。

例如

  • 2014-1-9上午08:30
  • 2015-1-1上午10:00
  • 2月 5, 2016 08:30am

假设我想在早上 8 点到 9 点之间到达。我想要的结果是

  • 2014-1-9上午08:30
  • 2月 5, 2016 08:30am

有人可以给我一些提示吗?谢谢

我只会使用moment.get('hour')和每个moment.get('minute')并进行一些简单的数学比较