WpfMdict / rust /mdict /src /utils /displayUtils.ts
fasdfsa's picture
update rust code
d159a6c
raw
history blame contribute delete
437 Bytes
// Format timestamp to readable date
export function formatDate(timestamp: number) {
const date = new Date(timestamp);
const now = new Date();
const isToday = date.toDateString() === now.toDateString();
if (isToday) {
return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
} else {
return date.toLocaleDateString('zh-CN', { month: 'short', day: 'numeric' });
}
};