Skip to content

Commit

Permalink
fix: UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed Sep 21, 2024
1 parent 28ded1a commit 124e90f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/messages/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1838,8 +1838,14 @@ MessagePtr MessageBuilder::buildHypeChatMessage(
#endif
subtitle += locale.toCurrencyString(actualAmount, currency);

MessageBuilder builder(systemMessage, parseTagString(subtitle),
calculateMessageTime(message).time());
auto dt = calculateMessageTime(message);
#ifdef CHATTERINO_WITH_TESTS
if (getApp()->isTest())
{
dt = dt.toUTC();
}
#endif
MessageBuilder builder(systemMessage, parseTagString(subtitle), dt.time());
builder->flags.set(MessageFlag::ElevatedMessage);
return builder.release();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/snapshots/MessageBuilder/IRC/hype-chat0.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
"trailingSpace": true,
"type": "TextElement",
"words": [
"4:46"
"2:46"
]
},
"flags": "Timestamp",
Expand All @@ -189,7 +189,7 @@
"type": "None",
"value": ""
},
"time": "04:46:14",
"time": "02:46:14",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
Expand Down
4 changes: 2 additions & 2 deletions tests/snapshots/MessageBuilder/IRC/hype-chat1.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
"trailingSpace": true,
"type": "TextElement",
"words": [
"18:43"
"16:43"
]
},
"flags": "Timestamp",
Expand All @@ -296,7 +296,7 @@
"type": "None",
"value": ""
},
"time": "18:43:51",
"time": "16:43:51",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
Expand Down
4 changes: 2 additions & 2 deletions tests/snapshots/MessageBuilder/IRC/hype-chat2.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
"trailingSpace": true,
"type": "TextElement",
"words": [
"18:43"
"16:43"
]
},
"flags": "Timestamp",
Expand All @@ -279,7 +279,7 @@
"type": "None",
"value": ""
},
"time": "18:43:54",
"time": "16:43:54",
"tooltip": "",
"trailingSpace": true,
"type": "TimestampElement"
Expand Down

0 comments on commit 124e90f

Please sign in to comment.