Validator icon indicating copy to clipboard operation
Validator copied to clipboard

New Rule: DateFormat:format

Open CSenshi opened this issue 5 years ago • 0 comments

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 :100:

CSenshi avatar Jul 12 '20 01:07 CSenshi