Skip to content

Commit

Permalink
Switch to prefixdate for dataset fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Jan 25, 2025
1 parent 84d08e6 commit b74aa97
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions nomenklatura/dataset/util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from normality import stringify
from prefixdate import parse as prefix_parse
from typing import Any, Dict, Iterable, List, Optional

from followthemoney.types import registry
from followthemoney.types.common import PropertyType
from normality import stringify

from nomenklatura.exceptions import MetadataException
from nomenklatura.util import iso_datetime, datetime_iso


def type_check(
Expand Down Expand Up @@ -37,10 +36,7 @@ def type_require(type_: PropertyType, value: Any) -> str:

def datetime_check(value: Any) -> Optional[str]:
"""Check that the given metadata field is a valid datetime."""
dt = iso_datetime(value)
if dt is not None:
return datetime_iso(dt)
return None
return prefix_parse(value).text


def int_check(value: Any) -> Optional[int]:
Expand Down

0 comments on commit b74aa97

Please sign in to comment.