arrow.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:kino-bot 作者: DongjunLee 项目源码 文件源码
def is_between(start_time: tuple, end_time: tuple, now=None) -> bool:
        if start_time is None and end_time is None:
            return True

        if now is None:
            now = datetime.datetime.now()

        start_h, start_m = start_time
        end_h, end_m = end_time

        if end_h == 24 and end_m == 0:
            end_h = 23
            end_m = 59

        start = now.replace(
            hour=start_h,
            minute=start_m,
            second=0,
            microsecond=0)
        end = now.replace(hour=end_h, minute=end_m, second=0, microsecond=0)
        if (start <= now <= end):
            return True
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号