Skip to content

Commit

Permalink
Merge pull request #2289 from nextcloud/refactor/neon_talk/timestamp-…
Browse files Browse the repository at this point in the history
…local-timezone
  • Loading branch information
provokateurin authored Jul 19, 2024
2 parents 3efd5dc + 85c8071 commit 9729f07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/neon/neon_talk/lib/src/pages/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class _TalkMainPageState extends State<TalkMainPage> {
);
}

final timestamp = lastChatMessage.parsedTimestamp.toLocal();
final timestamp = lastChatMessage.parsedTimestamp;

final time = Tooltip(
message: DateFormat.yMd().add_jm().format(timestamp),
Expand Down
10 changes: 5 additions & 5 deletions packages/neon/neon_talk/lib/src/utils/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ extension ChatMessageHidden on spreed.$ChatMessageInterface {
/// Helper extension for [spreed.$BaseMessageInterface]
extension $BaseMessageInterfaceHelpers on spreed.$BaseMessageInterface {
/// Parsed equivalent of [expirationTimestamp].
tz.TZDateTime get parsedExpirationTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.UTC, expirationTimestamp);
tz.TZDateTime get parsedExpirationTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.local, expirationTimestamp);
}

/// Helper extension for [spreed.$ChatMessageInterface]
extension $ChatMessageInterfaceHelpers on spreed.$ChatMessageInterface {
/// Parsed equivalent of [timestamp].
tz.TZDateTime get parsedTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.UTC, timestamp);
tz.TZDateTime get parsedTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.local, timestamp);

/// Parsed equivalent of [lastEditTimestamp].
tz.TZDateTime? get parsedLastEditTimestamp =>
lastEditTimestamp != null ? DateTimeUtils.fromSecondsSinceEpoch(tz.UTC, lastEditTimestamp!) : null;
lastEditTimestamp != null ? DateTimeUtils.fromSecondsSinceEpoch(tz.local, lastEditTimestamp!) : null;
}

/// Helper extension for [spreed.$ChatReminderInterface]
extension $ChatReminderInterfaceHelpers on spreed.$ChatReminderInterface {
/// Parsed equivalent of [timestamp].
tz.TZDateTime get parsedTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.UTC, timestamp);
tz.TZDateTime get parsedTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.local, timestamp);
}

/// Helper extension for [spreed.$ReactionInterface]
extension $ReactionInterfaceHelpers on spreed.$ReactionInterface {
/// Parsed equivalent of [timestamp].
tz.TZDateTime get parsedTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.UTC, timestamp);
tz.TZDateTime get parsedTimestamp => DateTimeUtils.fromSecondsSinceEpoch(tz.local, timestamp);
}
8 changes: 4 additions & 4 deletions packages/neon/neon_talk/lib/src/widgets/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,10 @@ class _TalkCommentMessageState extends State<TalkCommentMessage> {
final textTheme = Theme.of(context).textTheme;
final labelColor = Theme.of(context).colorScheme.inverseSurface.withOpacity(0.7);

final date = widget.chatMessage.parsedTimestamp.toLocal();
final date = widget.chatMessage.parsedTimestamp;
tz.TZDateTime? previousDate;
if (widget.previousChatMessage != null) {
previousDate = widget.previousChatMessage!.parsedTimestamp.toLocal();
previousDate = widget.previousChatMessage!.parsedTimestamp;
}

final separateMessages = widget.chatMessage.actorId != widget.previousChatMessage?.actorId ||
Expand All @@ -479,9 +479,9 @@ class _TalkCommentMessageState extends State<TalkCommentMessage> {
);

time = Tooltip(
message: _dateTimeFormat.format(date.toLocal()),
message: _dateTimeFormat.format(date),
child: Text(
_timeFormat.format(date.toLocal()),
_timeFormat.format(date),
style: textTheme.labelSmall,
),
);
Expand Down

0 comments on commit 9729f07

Please sign in to comment.