Skip to content

Properly format history timestamp#1473

Open
zealsham wants to merge 1 commit intopayjoin:masterfrom
zealsham:readable-time
Open

Properly format history timestamp#1473
zealsham wants to merge 1 commit intopayjoin:masterfrom
zealsham:readable-time

Conversation

@zealsham
Copy link
Copy Markdown
Collaborator

@zealsham zealsham commented Apr 12, 2026

This Pr addresses #1472. When the session history is displayed the timestmap isn't in readable form.

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 12, 2026

Coverage Report for CI Build 24428392141

Coverage decreased (-0.2%) to 84.136%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 45 uncovered changes across 2 files (0 of 45 lines covered, 0.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
payjoin-cli/src/app/v2/mod.rs 37 0 0.0%
payjoin-cli/src/db/v2.rs 8 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12834
Covered Lines: 10798
Line Coverage: 84.14%
Coverage Strength: 411.4 hits per line

💛 - Coveralls

error_message: Option<String>,
}

fn format_timestamps(value: &str) -> String {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

After attempting this , it worked well for completed at since thats stored in a column in db. but for the status field, when its expired its still a unix seconds because that's constructed entirely by rust without hitting the db layer.

Session ID Sender/Receiver Completed At Status

1            Receiver          2025-10-24 18:38:06 Session expired at Time(Time(1760095762))
2            Receiver          2025-10-24 18:38:06 Session expired at Time(Time(1760120713))
3            Receiver          2025-10-24 18:38:06 Session expired at Time(Time(1760126437))
4            Receiver          2025-10-24 18:38:06 Session expired at Time(Time(1760126556))
5            Receiver          2025-10-09 20:09:17 Session expired at Time(Time(1760126869))
6            Receiver          2025-10-24 18:38:06 Session expired at Time(Time(1760196351))

However if a session is yet to expire , the status field becomes

21           Receiver          Not Completed   Waiting for original proposal
1            Receiver          2025-10-24 18:38:06 Session expired at 2025-10-10 11:29:22 UTC
2            Receiver          2025-10-24 18:38:06 Session expired at 2025-10-10 18:25:13 UTC

one way i could solve this without an external dep is to implement display for Time struct in payjoin-core and then use something like the civil-from-days algorithm by Howard Hinnant (saw this via a google search) to derive the current time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah pure rust construction makes it a little trickier. I doubt this is a payjoin-core change though, if there's no way to display depending on sqlite if anything you'd want to implement that algo to display in payjoin-cli.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Gotcha!

@arminsabouri arminsabouri changed the title Properly format history timestmap Properly format history timestamp Apr 13, 2026
Copy link
Copy Markdown
Contributor

@DanGould DanGould left a comment

Choose a reason for hiding this comment

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

I also prefer sqlite formatting if we already have it over adding the chrono dependency.

This Pr addresses payjoin#1472. When the session history is displayed
the timestmap isn't in readable form. This Pr changes the time
from unix seconds into proper human readbale date/time.
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.

4 participants