diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp
index 06c4b6557..7043a7ecd 100644
--- a/Telegram/SourceFiles/apiwrap.cpp
+++ b/Telegram/SourceFiles/apiwrap.cpp
@@ -636,7 +636,7 @@ void ApiWrap::historyDialogEntryApplied(not_null<History*> history) {
 			if (!chat->haveLeft()) {
 				Local::addSavedPeer(
 					history->peer,
-					history->chatsListDate());
+					ParseDateTime(history->chatsListTimeId()));
 			}
 		} else if (const auto channel = history->peer->asChannel()) {
 			const auto inviter = channel->inviter;
@@ -653,12 +653,11 @@ void ApiWrap::historyDialogEntryApplied(not_null<History*> history) {
 		return;
 	}
 
-	if (!history->chatsListDate().isNull()
-		&& history->loadedAtBottom()) {
+	if (history->chatsListTimeId() != 0 && history->loadedAtBottom()) {
 		if (const auto channel = history->peer->asChannel()) {
 			const auto inviter = channel->inviter;
 			if (inviter != 0
-				&& history->chatsListDate() <= ParseDateTime(channel->inviteDate)
+				&& history->chatsListTimeId() <= channel->inviteDate
 				&& channel->amIn()) {
 				if (const auto from = App::userLoaded(inviter)) {
 					history->insertJoinedMessage(true);
diff --git a/Telegram/SourceFiles/core/utils.cpp b/Telegram/SourceFiles/core/utils.cpp
index 3c438d8b4..01ddb7dc2 100644
--- a/Telegram/SourceFiles/core/utils.cpp
+++ b/Telegram/SourceFiles/core/utils.cpp
@@ -125,6 +125,14 @@ QDateTime ParseDateTime(TimeId serverTime) {
 	return QDateTime::fromTime_t(serverTime - unixtimeDelta);
 }
 
+TimeId ServerTimeFromParsed(const QDateTime &date) {
+	if (date.isNull()) {
+		return TimeId(0);
+	}
+	QReadLocker locker(&unixtimeLock);
+	return date.toTime_t() + unixtimeDelta;
+}
+
 // Precise timing functions / rand init
 
 struct CRYPTO_dynlock_value {
diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h
index bdc258ea9..a3466e38f 100644
--- a/Telegram/SourceFiles/core/utils.h
+++ b/Telegram/SourceFiles/core/utils.h
@@ -196,6 +196,7 @@ uint64 msgid();
 int GetNextRequestId();
 
 QDateTime ParseDateTime(TimeId serverTime);
+TimeId ServerTimeFromParsed(const QDateTime &date);
 
 inline void mylocaltime(struct tm * _Tm, const time_t * _Time) {
 #ifdef Q_OS_WIN
diff --git a/Telegram/SourceFiles/data/data_feed.cpp b/Telegram/SourceFiles/data/data_feed.cpp
index 61ee6bff1..330e8db3f 100644
--- a/Telegram/SourceFiles/data/data_feed.cpp
+++ b/Telegram/SourceFiles/data/data_feed.cpp
@@ -150,7 +150,7 @@ void Feed::unregisterOne(not_null<ChannelData*> channel) {
 void Feed::updateLastMessage(not_null<HistoryItem*> item) {
 	if (justUpdateLastMessage(item)) {
 		if (_lastMessage && *_lastMessage) {
-			setChatsListDate(ItemDateTime(*_lastMessage));
+			setChatsListTimeId((*_lastMessage)->date());
 		}
 	}
 }
@@ -304,7 +304,7 @@ void Feed::setLastMessageFromChannels() {
 
 void Feed::updateChatsListDate() {
 	if (_lastMessage && *_lastMessage) {
-		setChatsListDate(ItemDateTime(*_lastMessage));
+		setChatsListTimeId((*_lastMessage)->date());
 	}
 }
 
diff --git a/Telegram/SourceFiles/dialogs/dialogs_entry.cpp b/Telegram/SourceFiles/dialogs/dialogs_entry.cpp
index f417175a9..2f5ec41b5 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_entry.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_entry.cpp
@@ -19,11 +19,11 @@ namespace {
 
 auto DialogsPosToTopShift = 0;
 
-uint64 DialogPosFromDate(const QDateTime &date) {
-	if (date.isNull()) {
+uint64 DialogPosFromDate(TimeId date) {
+	if (!date) {
 		return 0;
 	}
-	return (uint64(date.toTime_t()) << 32) | (++DialogsPosToTopShift);
+	return (uint64(date) << 32) | (++DialogsPosToTopShift);
 }
 
 uint64 ProxyPromotedDialogPos() {
@@ -73,7 +73,7 @@ void Entry::updateChatListSortPosition() {
 		? ProxyPromotedDialogPos()
 		: isPinnedDialog()
 		? PinnedDialogPos(_pinnedIndex)
-		: DialogPosFromDate(adjustChatListDate());
+		: DialogPosFromDate(adjustChatListTimeId());
 	if (needUpdateInChatList()) {
 		setChatListExistence(true);
 	}
@@ -94,8 +94,8 @@ void Entry::setChatListExistence(bool exists) {
 	}
 }
 
-QDateTime Entry::adjustChatListDate() const {
-	return chatsListDate();
+TimeId Entry::adjustChatListTimeId() const {
+	return chatsListTimeId();
 }
 
 void Entry::changedInChatListHook(Dialogs::Mode list, bool added) {
@@ -128,13 +128,13 @@ PositionChange Entry::adjustByPosInChatList(
 	return { movedFrom, movedTo };
 }
 
-void Entry::setChatsListDate(QDateTime date) {
-	if (!_lastMessageDate.isNull() && _lastMessageDate >= date) {
+void Entry::setChatsListTimeId(TimeId date) {
+	if (_lastMessageTimeId && _lastMessageTimeId >= date) {
 		if (!inChatList(Dialogs::Mode::All)) {
 			return;
 		}
 	}
-	_lastMessageDate = date;
+	_lastMessageTimeId = date;
 	updateChatListSortPosition();
 }
 
diff --git a/Telegram/SourceFiles/dialogs/dialogs_entry.h b/Telegram/SourceFiles/dialogs/dialogs_entry.h
index 5aed63e5a..ac4c6714c 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_entry.h
+++ b/Telegram/SourceFiles/dialogs/dialogs_entry.h
@@ -65,7 +65,7 @@ public:
 		return _sortKeyInChatList;
 	}
 	void updateChatListSortPosition();
-	void setChatsListDate(QDateTime date);
+	void setChatsListTimeId(TimeId date);
 	virtual void updateChatListExistence();
 	bool needUpdateInChatList() const;
 
@@ -94,8 +94,8 @@ public:
 		paintUserpic(p, rtl() ? (w - x - size) : x, y, size);
 	}
 
-	QDateTime chatsListDate() const {
-		return _lastMessageDate;
+	TimeId chatsListTimeId() const {
+		return _lastMessageTimeId;
 	}
 
 	virtual ~Entry() = default;
@@ -104,7 +104,7 @@ public:
 	mutable Text lastItemTextCache;
 
 private:
-	virtual QDateTime adjustChatListDate() const;
+	virtual TimeId adjustChatListTimeId() const;
 	virtual void changedInChatListHook(Dialogs::Mode list, bool added);
 	virtual void changedChatListPinHook();
 
@@ -118,7 +118,7 @@ private:
 	uint64 _sortKeyInChatList = 0;
 	int _pinnedIndex = 0;
 	bool _isProxyPromoted = false;
-	QDateTime _lastMessageDate;
+	TimeId _lastMessageTimeId = 0;
 
 };
 
diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
index 9a7162a44..7286273a1 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
@@ -1784,9 +1784,9 @@ void DialogsInner::applyDialog(const MTPDdialog &dialog) {
 	history->applyDialog(dialog);
 
 	if (!history->useProxyPromotion() && !history->isPinnedDialog()) {
-		const auto date = history->chatsListDate();
-		if (!date.isNull()) {
-			addSavedPeersAfter(date);
+		const auto date = history->chatsListTimeId();
+		if (date != 0) {
+			addSavedPeersAfter(ParseDateTime(date));
 		}
 	}
 	_contactsNoDialogs->del(history);
@@ -1818,7 +1818,7 @@ void DialogsInner::addSavedPeersAfter(const QDateTime &date) {
 	auto &saved = cRefSavedPeersByTime();
 	while (!saved.isEmpty() && (date.isNull() || date < saved.lastKey())) {
 		const auto history = App::history(saved.last()->id);
-		history->setChatsListDate(saved.lastKey());
+		history->setChatsListTimeId(ServerTimeFromParsed(saved.lastKey()));
 		_contactsNoDialogs->del(history);
 		saved.remove(saved.lastKey(), saved.last());
 	}
diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp
index cdd8ceace..ba43d9d9c 100644
--- a/Telegram/SourceFiles/history/history.cpp
+++ b/Telegram/SourceFiles/history/history.cpp
@@ -1827,14 +1827,11 @@ std::shared_ptr<AdminLog::LocalIdManager> History::adminLogIdManager() {
 	return result;
 }
 
-QDateTime History::adjustChatListDate() const {
-	const auto result = chatsListDate();
+TimeId History::adjustChatListTimeId() const {
+	const auto result = chatsListTimeId();
 	if (const auto draft = cloudDraft()) {
 		if (!Data::draftIsNull(draft)) {
-			const auto draftResult = ParseDateTime(draft->date);
-			if (draftResult > result) {
-				return draftResult;
-			}
+			return std::max(result, draft->date);
 		}
 	}
 	return result;
@@ -2182,7 +2179,7 @@ void History::setLastMessage(HistoryItem *item) {
 		if (const auto feed = peer->feed()) {
 			feed->updateLastMessage(item);
 		}
-		setChatsListDate(ItemDateTime(item));
+		setChatsListTimeId(item->date());
 	} else if (!_lastMessage || *_lastMessage) {
 		_lastMessage = nullptr;
 		updateChatListEntry();
@@ -2500,8 +2497,8 @@ HistoryService *History::insertJoinedMessage(bool unread) {
 					inviter,
 					flags);
 				addNewInTheMiddle(_joinedMessage, blockIndex, itemIndex);
-				const auto lastDate = chatsListDate();
-				if (lastDate.isNull() || ParseDateTime(inviteDate) >= lastDate) {
+				const auto lastDate = chatsListTimeId();
+				if (!lastDate || inviteDate >= lastDate) {
 					setLastMessage(_joinedMessage);
 					if (unread) {
 						newItemAdded(_joinedMessage);
diff --git a/Telegram/SourceFiles/history/history.h b/Telegram/SourceFiles/history/history.h
index 39ac4638b..54556c337 100644
--- a/Telegram/SourceFiles/history/history.h
+++ b/Telegram/SourceFiles/history/history.h
@@ -445,7 +445,7 @@ private:
 		not_null<Element*> view);
 	void removeNotification(not_null<HistoryItem*> item);
 
-	QDateTime adjustChatListDate() const override;
+	TimeId adjustChatListTimeId() const override;
 	void changedInChatListHook(Dialogs::Mode list, bool added) override;
 	void changedChatListPinHook() override;
 
diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp
index aeeff8313..196a70940 100644
--- a/Telegram/SourceFiles/window/window_controller.cpp
+++ b/Telegram/SourceFiles/window/window_controller.cpp
@@ -334,14 +334,14 @@ void Controller::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
 						return history->blocks.front()->messages.front()->dateTime().date();
 					}
 				}
-			} else if (!history->chatsListDate().isNull()) {
-				return history->chatsListDate().date();
+			} else if (history->chatsListTimeId() != 0) {
+				return ParseDateTime(history->chatsListTimeId()).date();
 			}
 		} else if (const auto feed = chat.feed()) {
 			/*if (chatScrollPosition(feed)) { // #TODO feeds save position
 
-			} else */if (!feed->chatsListDate().isNull()) {
-				return feed->chatsListDate().date();
+			} else */if (feed->chatsListTimeId() != 0) {
+				return ParseDateTime(feed->chatsListTimeId()).date();
 			}
 		}
 		return QDate::currentDate();
@@ -351,12 +351,12 @@ void Controller::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
 			if (const auto channel = history->peer->migrateTo()) {
 				history = App::historyLoaded(channel);
 			}
-			if (history && !history->chatsListDate().isNull()) {
-				return history->chatsListDate().date();
+			if (history && history->chatsListTimeId() != 0) {
+				return ParseDateTime(history->chatsListTimeId()).date();
 			}
 		} else if (const auto feed = chat.feed()) {
-			if (!feed->chatsListDate().isNull()) {
-				return feed->chatsListDate().date();
+			if (feed->chatsListTimeId() != 0) {
+				return ParseDateTime(feed->chatsListTimeId()).date();
 			}
 		}
 		return QDate::currentDate();