conditions.py 文件源码

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

项目:wagtail-flags 作者: cfpb 项目源码 文件源码
def date_condition(date_or_str, **kwargs):
    """ Does the current date match the given date?
    date_or_str is either a date object or an ISO 8601 string """
    try:
        date = dateparse.parse_datetime(date_or_str)
    except TypeError:
        date = date_or_str

    now = timezone.now()

    try:
        date_test = (now >= date)
    except TypeError:
        date_test = False

    return date_test
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号