We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d09feb6 commit 781f8cdCopy full SHA for 781f8cd
jsonschema/_format.py
@@ -17,6 +17,8 @@
17
typing.Type[Exception], typing.Tuple[typing.Type[Exception], ...],
18
]
19
20
+_RE_DATE = re.compile(r"^\d{4}-\d{2}-\d{2}$", re.ASCII)
21
+
22
23
class FormatChecker:
24
"""
@@ -396,7 +398,10 @@ def is_regex(instance: object) -> bool:
396
398
def is_date(instance: object) -> bool:
397
399
if not isinstance(instance, str):
400
return True
- return bool(instance.isascii() and datetime.date.fromisoformat(instance))
401
+ return bool(
402
+ _RE_DATE.fullmatch(instance)
403
+ and datetime.date.fromisoformat(instance)
404
+ )
405
406
407
@_checks_drafts(draft3="time", raises=ValueError)
0 commit comments