MCPcopy Create free account
hub / github.com/astercloud/aster / formatMessageDate

Function formatMessageDate

ui/src/composables/useMessage.ts:163–179  ·  view source on GitHub ↗
(timestamp: number)

Source from the content-addressed store, hash-verified

161
162// 辅助函数:格式化消息日期
163function formatMessageDate(timestamp: number): string {
164 const date = new Date(timestamp);
165 const today = new Date();
166 const yesterday = new Date(today);
167 yesterday.setDate(yesterday.getDate() - 1);
168
169 if (date.toDateString() === today.toDateString()) {
170 return "今天";
171 } else if (date.toDateString() === yesterday.toDateString()) {
172 return "昨天";
173 } else {
174 return date.toLocaleDateString("zh-CN", {
175 month: "long",
176 day: "numeric",
177 });
178 }
179}

Callers 1

useMessageListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected