DailyReportBuilder

enum DailyReportBuilder

Builds the data for a daily report and prefills its text. The text it writes is a starting point: people edit all of it.

  • The sections nobody but a person can fill in. Regeneration never touches these.

    Declaration

    Swift

    static let freeFormSections: [String]

Window

  • defaultWindow(now:on:) Asynchronous

    The default reporting window: the 24 hours ending at the most recent occurrence of the configured cutoff time (5PM unless Settings.dailyReportEndHour/dailyReportEndMinute say otherwise), ship time.

    Declaration

    Swift

    static func defaultWindow(now: Date = Date(), on db: Database) async throws -> (start: Date, end: Date)
  • The default report title: the weekday the period ends on, in ship time (e.g. “Monday”). A 5PM-to-5PM period is “Monday’s report”.

    Declaration

    Swift

    static func defaultTitle(forWindowEnd end: Date) -> String
  • A readable reporting period with weekdays, in ship time: “Mon 3/21/26, 5:00 PM - Tue 3/22/26, 5:00 PM PDT”. If the period spans a time zone change, each end shows its own zone.

    See more

    Declaration

    Swift

    static func windowText(start: Date, end: Date) -> String
  • Which day of the cruise (1 = embarkation day) a moment falls on, or nil if it’s outside the cruise.

    Declaration

    Swift

    static func cruiseDay(for date: Date) -> Int?

Collection

Prefill