Skip to content

New Rule: DateFormat:format #77

@CSenshi

Description

@CSenshi

Rule Name: DateFormat

Rule Arguments:

  1. format - String that represents python datetime format

Rule Description:
The field under validation must match the given format

Rule Usage Example:

reqs = {'data' : '2018-06-29 08:15:27'}
rule = {'data' : 'date_format:%Y-%m-%d %H:%M:%S'}
validate(reqs, rule) # True

reqs = {'data' : '2018-06-29 08:15:27'}
rule = {'data' : 'date_format:%Y-%m-%d'}
validate(reqs, rule) # False, because 08:15:27 is unconverted data

Before contributing please review RULES.md (check for duplication), also check CONTRIBUTING.md for more details 💯

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions