| 4683 | const yesterday = new Date(); |
| 4684 | yesterday.setDate(yesterday.getDate() - 1); |
| 4685 | const yesterdayValue = `${yesterday.getFullYear()}-${String(yesterday.getMonth() + 1).padStart(2, "0")}-${String(yesterday.getDate()).padStart(2, "0")}`; |
| 4686 | if (date === yesterdayValue) return ui().chat.yesterday; |
| 4687 | return date; |
| 4688 | } |
| 4689 | |
| 4690 | function formatChatTime(value) { |
| 4691 | const text = String(value || ""); |
| 4692 | const match = text.match(/(\d{2}):(\d{2})/); |
| 4693 | return match ? `${match[1]}:${match[2]}` : ""; |
| 4694 | } |
| 4695 | |
| 4696 | function renderChatHistory(data = {}) { |
| 4697 | const sessions = Array.isArray(data.sessions) ? data.sessions : state.chatHistory; |
| 4698 | let groups = Array.isArray(data.groups) ? data.groups : state.chatHistoryGroups; |
| 4699 | if ((!groups || !groups.length) && sessions.length) { |