Skip to content

Commit

Permalink
Fix datetime.utcnow() deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavies-st committed Jan 18, 2024
1 parent 9e7c441 commit 86279da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/stpipe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
both until we replace configobj with traitlets.
"""
from copy import deepcopy
from datetime import datetime
from datetime import UTC, datetime

import asdf

Expand Down Expand Up @@ -111,7 +111,10 @@ def to_asdf(self, include_metadata=False):
meta = deepcopy(_META_TEMPLATE)
meta["date"] = meta["date"].replace(
_TEMPLATE_PLACEHOLDER,
datetime.utcnow().replace(microsecond=0).isoformat(),
datetime.now(UTC)
.replace(microsecond=0)
.isoformat()
.removesuffix("+00:00"),
)
meta["description"] = meta["description"].replace(
_TEMPLATE_PLACEHOLDER, self.class_name
Expand Down

0 comments on commit 86279da

Please sign in to comment.