using System; using System.Globalization; namespace URLNotesGrabberCORE { /// /// The single format for Posts.PostDate: "yyyy-MM-dd HH:mm:ss GMT", which is what the /// Tumblr API sends and what nearly every row holds. Text-file exports can carry the /// RFC 1123 form ("Fri, 14 Feb 2025 15:20:09 GMT") instead, which as text sorts on its /// weekday name and falls outside every --fromDate/--toDate range comparison. /// /// Every path that writes PostDate routes through . Only the RFC 1123 /// form is rewritten; anything else, including the "." no-change sentinel, passes through. /// public static class PostDates { public static string? Normalize(string? value) { if (string.IsNullOrWhiteSpace(value)) return value; string trimmed = value.Trim(); if (DateTime.TryParseExact(trimmed, "r", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime parsed)) return parsed.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture) + " GMT"; return value; } } }