Skip to content

Add helper for converting ISO timestamp string to UTC Date object safely #548

Description

@Chucks1093

Summary

Several endpoints accept and return timestamp strings. Parsing these to Date objects is done inconsistently across the codebase. A shared helper that parses an ISO string and throws a typed error for invalid input should be used everywhere a timestamp is read from external data.

Scope

  • Add parseISOTimestamp(value: string): Date helper
  • Throws InvalidTimestamp error if the string is not a valid ISO 8601 date
  • Returns a UTC Date object for valid input
  • Add unit tests for: valid ISO string, invalid string, empty string, Unix timestamp string

Acceptance Criteria

  • Valid ISO string returns correct UTC Date
  • Invalid string throws InvalidTimestamp
  • Empty string throws InvalidTimestamp
  • Unix timestamp string throws InvalidTimestamp

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions