From 779c278854314978d0ae17dc51ea1f1ffa11e175 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 12 Oct 2022 11:33:00 +0200 Subject: [PATCH] refactor: Use DateTime method instead of comparing milliseconds --- lib/src/client.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 21fe495f..1500ee00 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -324,11 +324,10 @@ class Client extends MatrixApi { if (r == null) { return prev; } - final prevLast = - prev.lastEvent?.originServerTs.millisecondsSinceEpoch ?? 0; - final rLast = r.lastEvent?.originServerTs.millisecondsSinceEpoch ?? 0; + final prevLast = prev.lastEvent?.originServerTs ?? DateTime(0); + final rLast = r.lastEvent?.originServerTs ?? DateTime(0); - return rLast > prevLast ? r : prev; + return rLast.isAfter(prevLast) ? r : prev; }).id; } }