feat: add iOS support and harden receipt scanning

This commit is contained in:
Timo
2026-08-20 23:48:26 +02:00
parent f5e06c32b0
commit cf1b799e1b
107 changed files with 11755 additions and 122 deletions

View File

@@ -0,0 +1,25 @@
import Foundation
/// The backend serialises every timestamp with `Date.prototype.toISOString()`,
/// which always includes milliseconds (`...307Z`). `ISO8601DateFormatter`'s
/// default options reject that string, so every date in this app must go
/// through this helper rather than a bare `ISO8601DateFormatter()` using
/// the wrong one is a silent-failure trap, not a compile error.
enum ISO8601 {
private static let withFractional: ISO8601DateFormatter = {
let f = ISO8601DateFormatter()
f.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
return f
}()
private static let withoutFractional: ISO8601DateFormatter = {
let f = ISO8601DateFormatter()
f.formatOptions = [.withInternetDateTime]
return f
}()
static func parse(_ string: String?) -> Date? {
guard let string else { return nil }
return withFractional.date(from: string) ?? withoutFractional.date(from: string)
}
}