Example #1
0
def match_date(date: Date, mask: str) -> bool:
    """Check if date matches mask."""
    if date is not None and date.is_valid():
        year_mask, month_mask, day_mask = mask.split("/")
        date = gregorian(date)
        year = date.get_year()
        if year_mask == "*" or year == int(year_mask):
            month = date.get_month()
            if month_mask == "*" or month == int(month_mask):
                day = date.get_day()
                if day_mask == "*" or day == int(day_mask):
                    return True
    return False