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
ETA: 12 hours
Coordinate on Telegram
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
parseISOTimestamp(value: string): DatehelperInvalidTimestamperror if the string is not a valid ISO 8601 dateAcceptance Criteria
InvalidTimestampInvalidTimestampInvalidTimestampETA: 12 hours
Coordinate on Telegram