Skip to content

feat: add toISOTimestamp utility and apply consistently across routes#236

Merged
Sulex45 merged 1 commit into
stellarkit-lab-devtools:mainfrom
sadiqabubakar826-del:feat/iso-timestamp-utility
Jun 2, 2026
Merged

feat: add toISOTimestamp utility and apply consistently across routes#236
Sulex45 merged 1 commit into
stellarkit-lab-devtools:mainfrom
sadiqabubakar826-del:feat/iso-timestamp-utility

Conversation

@sadiqabubakar826-del
Copy link
Copy Markdown

Add toISOTimestamp utility and apply consistently across all routes

Adds a toISOTimestamp(value) utility function to src/utils/response.js that normalizes all
timestamp fields in API responses to ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ).

What changed

  • src/utils/response.js — added toISOTimestamp(value) handling Unix seconds, Unix milliseconds,
    Stellar date strings, and JS Date objects. formatTimestamp kept as a deprecated alias.
  • src/routes/transactions.js — applied to createdAt on transaction records, operation records,
    and batch-status results.
  • src/routes/account.js — applied to firstSeen, lastSeen (analytics), lastTransactionAt
    (inactivity), createdAt (payments), and timestamp (offer history).
  • src/routes/networkStatus.js — applied to closedAt on the latest ledger.
  • src/utils/formatTransaction.js — applied to created_at in the SSE stream formatter.
  • tests/utils.toISOTimestamp.test.js — 10 tests covering null/undefined/empty, ISO strings,
    Date objects, Unix seconds, Unix milliseconds, and output format validation.
  • tests/transactions.batch.test.js — updated assertions to match normalized .000Z suffix.

Why

Previously, timestamps were passed through as raw Horizon strings (e.g. 2024-07-01T12:00:00Z)
without normalization. The new utility ensures every timestamp field across all endpoints uses
a consistent, fully-normalized ISO 8601 format regardless of input type.

▸ Credits: 0.19 • Time: 10s
─────────────────────────────────────────────────────────────────────────────────────────────────
check out to new branch commit and push

The branch was already created, committed, and pushed in the previous step. There's nothing new
to commit — the working tree is clean:
● Shell cd /workspaces/stellarkit-api && git status && git log --oneline -3
On branch feat/iso-timestamp-utility
Your branch is up to date with 'origin/feat/iso-timestamp-utility'.
nothing to commit, working tree clean
e108082 feat: add toISOTimestamp utility and apply consistently across routes
...+3 lines (ctrl+o to toggle)

You're already on feat/iso-timestamp-utility, the commit is there, and it's up to date with the
remote. Nothing left to do — you can open a PR directly from:

https://github.com/sadiqabubakar826-del/stellarkit-api/pull/new/feat/iso-timestamp-utility

closes #213

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@sadiqabubakar826-del Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Sulex45 Sulex45 merged commit c506bb9 into stellarkit-lab-devtools:main Jun 2, 2026
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.

API Response Timestamp Standardizer

2 participants