mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
minimize timestamp in thread
This commit is contained in:
parent
8ed7141ae6
commit
a081f5f36d
@ -85,9 +85,13 @@ export function useTopicItem(topic) {
|
||||
let createdStr;
|
||||
const date = new Date(created * 1000);
|
||||
const now = new Date();
|
||||
if(now.getTime() - date.getTime() < 86400000) {
|
||||
const offset = now.getTime() - date.getTime();
|
||||
if(offset < 86400000) {
|
||||
createdStr = date.toLocaleTimeString([], {hour: 'numeric', minute:'2-digit'});
|
||||
}
|
||||
else if (offset < 31449600000) {
|
||||
createdStr = date.toLocaleDateString("en-US", {day: 'numeric', month:'numeric'});
|
||||
}
|
||||
else {
|
||||
createdStr = date.toLocaleDateString("en-US");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user