Skip to content

Unify ISO8601 date parsing across ClaudeConversationIndex and TranscriptParser #58

@2witstudios

Description

@2witstudios

Context

Two files create their own ISO8601DateFormatter instances and parseTimestamp functions:

ClaudeConversationIndex.swift (lines 76-86, 385-389)

  • Two formatters: one with fractional seconds, one without
  • parseTimestamp returns Date? — tries fractional first, then plain, returns nil on failure

TranscriptParser.swift (lines 175-184)

  • One formatter: fractional seconds only
  • parseTimestamp returns Date — falls back to Date() on failure (masks parse errors)

Differences

The two implementations have subtly different semantics:

  • ClaudeConversationIndex handles timestamps both with and without fractional seconds
  • TranscriptParser only handles fractional seconds — timestamps without them silently return Date() (current time)

Proposal

Create a shared DateParsing utility (or extend the existing ShellUtilities.swift) with:

enum DateParsing {
    static func parseISO8601(_ value: String?) -> Date? { ... }
}

Both callers adopt the shared version, with TranscriptParser using ?? Date() at the call site if it needs that fallback.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions