Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a default timezone arg to jsonld import, re yale#9708 #10836

Merged
merged 15 commits into from
Jun 19, 2024

Conversation

ryan86
Copy link
Contributor

@ryan86 ryan86 commented Apr 25, 2024

Add timezone flag to jsonld import to indicate timezone for data that may not include a timezone by default, re #9708

@@ -650,6 +650,13 @@ def find_matching_branch(self, k, v, tree_node, result, tile=None, indent=0):
else:
self.printline(f"Could not validate {values} as a {o['datatype']}", indent + 1)
else:
if o["datatype"].datatype_name == 'date':
try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
if self.default_timezone and o["datatype"].datatype_name == 'date':

Copy link
Contributor Author

@ryan86 ryan86 May 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the try/except block couldn't this fail if the value can't be parsed on this line

datetime.datetime.strptime(value, "%Y-%m-%d %H:%M:%S")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry meant my suggestion to be this:

Suggested change
try:
if self.default_timezone and o["datatype"].datatype_name == 'date':
try:

@ryan86 ryan86 requested a review from apeters May 1, 2024 03:45
Copy link
Member

@apeters apeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@apeters apeters merged commit e6d8495 into dev/7.6.x Jun 19, 2024
7 checks passed
@apeters apeters deleted the 9708_default_timezone_jsonld_import branch June 19, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants