do not trash milliseconds
This commit is contained in:
@@ -47,12 +47,15 @@ class GotifyMessageModel(AttributeDict):
|
||||
title: Optional[str] = None
|
||||
|
||||
def __init__(self, d: dict, *args, **kwargs):
|
||||
s = (
|
||||
d["date"].split(".")[0] # date
|
||||
+ "."
|
||||
+ d["date"].split(".")[1][:6] # ms
|
||||
+ "+"
|
||||
+ d["date"].split("+")[-1] # timezone
|
||||
)
|
||||
d.update(
|
||||
{
|
||||
"date": datetime.datetime.fromisoformat(
|
||||
d["date"].split(".")[0] + ".000000+" + d["date"].split("+")[-1]
|
||||
).astimezone(local_timezone)
|
||||
}
|
||||
{"date": datetime.datetime.fromisoformat(s).astimezone(local_timezone)}
|
||||
)
|
||||
super(GotifyMessageModel, self).__init__(d, *args, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user