Skip to content

v0.7.2 — Date Parsing + Nullable Timestamps

Choose a tag to compare

@realwahl realwahl released this 30 Nov 01:22
· 8 commits to master since this release
  • RFC3339 timestamp parsing hardened to accept Z and offset forms.
  • Timestamps that cannot be parsed now return null instead of throwing.

Changes

  • Transaction::getCreatedAt() → now returns ?DateTime
  • Operation::getCreatedAt() → now returns ?DateTime
  • Ledger::getClosedAt() → now returns ?DateTime
  • Scripts/docs: clearer integration and hardware‑wallet test helpers and env checks.

Why

  • Horizon returns RFC3339 timestamps with slight variations (e.g., ...Z, ...+00:00). Using PHP’s DateTime makes parsing
    more robust. When a value is unparsable, returning null avoids surprising exceptions.

Upgrade Notes

  • Guard against null when using the timestamp accessors.
  • Example before:
    • $tx->getCreatedAt()->format(DATE_ATOM);
  • Example after:
    $createdAt = $tx->getCreatedAt();
    $createdAtStr = $createdAt ? $createdAt->format(DATE_ATOM) : null;
  • Do the same for Operation::getCreatedAt() and Ledger::getClosedAt().

Compatibility

  • PHP: ^7.3 || ^8.0
  • No API removals; only return type behavior changes to nullable.