Skip to content

Conversation

@dangrous
Copy link
Contributor

@dangrous dangrous commented Dec 18, 2025

As the title says.

This was 99% Cursor, not me, so feel free to rip it apart. Seems to work okay though.

Look at the bottom of your sidebar (example, on this PR!) and try toggling timestamps on and off! That's all this does, but it seems helpful - https://expensify.slack.com/archives/CDXCTAJQP/p1766012917820919

image

@dangrous dangrous marked this pull request as ready for review December 23, 2025 21:57
@dangrous dangrous requested a review from a team December 23, 2025 22:01
@melvin-bot melvin-bot bot requested review from JS00001 and removed request for a team December 23, 2025 22:02
// Set up timestamp format conversion
const applyTimestampFormatPeriodic = AllPages.applyTimestampFormat();
setTimeout(() => applyTimestampFormatPeriodic(), 500);
setInterval(() => applyTimestampFormatPeriodic(), 2000);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure how this works, but a constant loop to do this seems a bit excessive. Could we just apply timestamp on page load rather than every 2 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I think this is to allow for things like "load more" button presses, so we probably want it at least somewhat periodically? Can definitely slow it down, though - let me know what you think!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the changes that k2 makes on typical pages are done repeatedly, but I don't know how frequent it needs to be. I bet we could consolidate them all down to like every 5 sec and no one would notice a difference

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me, thanks!

@dangrous dangrous requested a review from JS00001 December 30, 2025 20:07
@dangrous
Copy link
Contributor Author

okay i simplified the timestamp stuff to only one interval, and set it to 5 seconds

}

ghToken = preferences.ghToken;
useAbsoluteTimestamps = preferences.useAbsoluteTimestamps || false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!preferences.useAbsoluteTimestamps

}

function getUseAbsoluteTimestamps() {
return useAbsoluteTimestamps || false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return useAbsoluteTimestamps

}

// Set up timestamp format conversion
const applyTimestampFormatPeriodic = AllPages.applyTimestampFormat();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we return a function here? Why not use AllPages.applyTimestampFormat as the function for the settimeout/setinterval? Is it so that we only call it once?

const absoluteTime = formatTimestamp(datetime);
absoluteSpan.textContent = ` (${absoluteTime})`;
absoluteSpan.dataset.k2AbsolutePart = 'true';

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use strings for bools here? Is this common elsewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants