crossmate

A collaborative crossword app for iOS
Log | Files | Refs | LICENSE

commit 4e176831a30049237940c874fda3ac503951c506
parent 51dea575b98467630bb0174fe041bd62943a3938
Author: Michael Camilleri <[email protected]>
Date:   Sat, 23 May 2026 19:10:48 +0900

Use correct time when refetching puzzle

Diffstat:
MCrossmate/Models/XD.swift | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Crossmate/Models/XD.swift b/Crossmate/Models/XD.swift @@ -252,11 +252,20 @@ struct XD: Sendable { let month = Int(match.2), let day = Int(match.3) else { return nil } + // Pin to America/New_York: puzzle dates are publication dates in NYT's + // timezone, and downstream fetchers (NYTPuzzleFetcher) format the Date + // back to a YYYY-MM-DD string in that zone. Without an explicit zone + // the system default fires here, which on a device east of NY yields a + // Date that formats back to the previous day — wrong puzzle. + var calendar = Calendar(identifier: .gregorian) + calendar.timeZone = TimeZone(identifier: "America/New_York") ?? .gmt var comps = DateComponents() + comps.calendar = calendar + comps.timeZone = calendar.timeZone comps.year = year comps.month = month comps.day = day - return Calendar(identifier: .gregorian).date(from: comps) + return calendar.date(from: comps) } /// Parses a Crossmate `CmVer:` header. Missing versions are version 1 so