Skip to content

Commit

Permalink
handle YYYY-MM-DDTHH:MM:SS date parsing (#255)
Browse files Browse the repository at this point in the history
* handle YYYY-MM-DDTHH:MM:SS date parsing

* update maintainer info
  • Loading branch information
tomkralidis authored Feb 4, 2025
1 parent 030d28e commit 5c6015c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion pygeometa/schemas/ogcapi_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# those files. Users are asked to read the 3rd Party Licenses
# referenced with those assets.
#
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2025 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -427,6 +427,10 @@ def generate_date(self, date_value: str) -> str:
format_ = '%Y-%m'
elif len(date_value) == 4: # YYYY
format_ = '%Y'
elif len(date_value) == 19: # YYYY-MM-DDTHH:MM:SS
msg = 'YYYY-MM-DDTHH:MM:SS with no timezone; converting to UTC'
LOGGER.debug(msg)
format_ = '%Y-%m-%dT%H:%M:%S'

LOGGER.debug('date type found; expanding to date-time')
value = datetime.strptime(date_value, format_).strftime('%Y-%m-%dT%H:%M:%SZ') # noqa
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# referenced with those assets.
#
# Copyright (c) 2016 Government of Canada
# Copyright (c) 2022 Tom Kralidis
# Copyright (c) 2025 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -111,10 +111,10 @@ def get_package_version():
'catalogue',
'discovery'
]),
author='Meteorological Service of Canada',
author_email='[email protected]',
maintainer='Meteorological Service of Canada',
maintainer_email='[email protected]',
author='Tom Kralidis',
author_email='[email protected]',
maintainer='Tom Kralidis',
maintainer_email='[email protected]',
url='https://geopython.github.io/pygeometa',
install_requires=read('requirements.txt').splitlines(),
packages=find_packages(),
Expand Down

0 comments on commit 5c6015c

Please sign in to comment.