Skip to content

Commit

Permalink
Explicit UTC timezone declaration for instances of datetime.now()
Browse files Browse the repository at this point in the history
  • Loading branch information
slothkong committed Mar 30, 2024
1 parent c03f905 commit d8142cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,10 @@ def safe_update_project_parser_files_partially(self, project_parser_files: Dict)
def check_for_model_deprecations(self):
for node in self.manifest.nodes.values():
if isinstance(node, ModelNode):
if node.deprecation_date and node.deprecation_date < datetime.now().astimezone():
if (
node.deprecation_date
and node.deprecation_date < datetime.now(timezone.utc).astimezone()
):
warn_or_error(
DeprecatedModel(
model_name=node.name,
Expand All @@ -602,7 +605,7 @@ def check_for_model_deprecations(self):
node.depends_on
for resolved_ref in resolved_model_refs:
if resolved_ref.deprecation_date:
if resolved_ref.deprecation_date < datetime.now().astimezone():
if resolved_ref.deprecation_date < datetime.now(timezone.utc).astimezone():
event_cls = DeprecatedReference
else:
event_cls = UpcomingReferenceDeprecation
Expand Down

0 comments on commit d8142cd

Please sign in to comment.