             self.period = .dateRange(.distantPast ... .distantFuture)
         }
         
-        let openHour = try values.decode(String.self, forKey: .opens)
-        let closeHour = try values.decode(String.self, forKey: .closes)
-        
-        self.opens = TimeOfDay(string: openHour)
-        self.closes = TimeOfDay(string: closeHour)
+        if let openHour = try? values.decode(String.self, forKey: .opens), let closeHour = try? values.decode(String.self, forKey: .closes) {
+            self.opens = TimeOfDay(string: openHour)
+            self.closes = TimeOfDay(string: closeHour)
+        }
     }
 }
 

    }
    
    public var period: Period
    public var opens: TimeOfDay
    public var closes: TimeOfDay
    
    public init(period: Period, opens: TimeOfDay, closes: TimeOfDay) {
        self.period = period
        self.opens = opens
        self.closes = closes

    
    public func contains(date: Date) -> Bool {
        
        guard let openTime = opens, let closeTime = closes, period.contains(date: date) else { return false }

        let cal = Calendar(identifier: .gregorian)
        let openDate = cal.date(bySettingHour: openTime.hours, minute: openTime.minutes, second: openTime.seconds, of: date) ?? .distantPast
        let closeDate = cal.date(bySettingHour: closeTime.hours, minute: closeTime.minutes, second: closeTime.seconds, of: date) ?? .distantFuture
        
        return date >= openDate && date <= closeDate
    }
