Path: redb-route/redb.Route.Firebase/Storage/GcsDateTimeHelper.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Firebase/Storage/GcsDateTimeHelper.cs ---- using System.Globalization; namespace redb.Route.Firebase; /// /// Safely reads DateTimeOffset from a GCS object, falling back to manual parsing /// when the SDK's typed accessor throws (e.g. non-RFC 3339 from emulators). /// Always returns ? — never a raw string. /// internal static class GcsDateTimeHelper { /// /// Safely resolves a DateTimeOffset from a GCS object property. /// /// SDK typed accessor (e.g. obj.TimeCreatedDateTimeOffset). /// Raw JSON string (e.g. obj.TimeCreatedRaw). internal static DateTimeOffset? SafeParse(Func accessor, string? raw) { try { return accessor(); } catch (FormatException) { // SDK couldn't parse — try manual parse of the raw string. if (raw is not null && DateTimeOffset.TryParse(raw, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces, out var dto)) { return dto; } return null; } } }