Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nicer Activity date format #465

Merged
merged 9 commits into from
Nov 19, 2024
8 changes: 7 additions & 1 deletion scripts/dashboard/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,17 @@ async function parseTXs(arrTXs) {
for (const cTx of arrTXs) {
const cTxDate = new Date(cTx.time * 1000);

// Check if it was today (same day, month and year)
const fToday =
panleone marked this conversation as resolved.
Show resolved Hide resolved
cTxDate.getDate() === cDate.getDate() &&
cTxDate.getMonth() === cDate.getMonth() &&
cTxDate.getFullYear() === cDate.getFullYear();

// Unconfirmed Txs are simply 'Pending'
let strDate = 'Pending';
if (cTx.blockHeight !== -1) {
// Figure out the most convenient time display for this Tx
if (cTxDate.getDate() === cDate.getDate()) {
if (fToday) {
// TXs made today are displayed by time (02:13 pm)
strDate = cTxDate.toLocaleTimeString(undefined, timeOptions);
} else if (cTxDate.getFullYear() === cDate.getFullYear()) {
Expand Down
Loading