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

Fix notes datetime ISO 8601 format #827

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/keri/app/notifying.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
keri.app.notifying module
"""
import datetime
from collections.abc import Iterable
from typing import Union, Type

Expand Down Expand Up @@ -71,7 +70,7 @@ def __init__(self, raw=b'', pad=None, note=None):
raise ValueError(f"invalid notice, missing attributes in {pad}")

if "dt" not in self._pad:
self._pad["dt"] = datetime.datetime.now().isoformat()
self._pad["dt"] = helping.nowIso8601()

@property
def datetime(self):
Expand Down Expand Up @@ -386,7 +385,7 @@ def add(self, attrs):
"""

note = notice(attrs, dt=datetime.datetime.now())
note = notice(attrs, dt=helping.nowIso8601())
cig = self.hby.signator.sign(ser=note.raw)
if self.noter.add(note, cig):
signal = dict(
Expand Down
4 changes: 4 additions & 0 deletions tests/app/test_notifying.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def test_noter():
assert res[1][0].attrs['a'] == 2
assert res[2][0].attrs['a'] == 3

assert res[2][0].datetime[-6:] == "+00:00"

# test paginated iteration
for i in range(10):
note = notifying.notice(attrs=dict(a=i))
Expand Down Expand Up @@ -208,6 +210,8 @@ def test_notifier():
notes = notifier.getNotes()
assert len(notes) == 3

assert notes[2].datetime[-6:] == "+00:00"
m00sey marked this conversation as resolved.
Show resolved Hide resolved

payload = dict(a=1, b=2, c=3)
dt = helping.fromIso8601("2022-07-08T15:01:05.453632")
cig = coring.Cigar(qb64="AABr1EJXI1sTuI51TXo4F1JjxIJzwPeCxa-Cfbboi7F4Y4GatPEvK629M7G_5c86_Ssvwg8POZWNMV-WreVqBECw")
Expand Down
Loading