#Preview Compiling failed: ambiguous use of operator '=='

My MacOS app only cares about days, not time-of-days, so I made a simple Date Extension:

extension Date {
    static func ==(lhs: Date, rhs: Date) -> Bool {
        let order = Calendar.current.compare(lhs, to: rhs, toGranularity: .day)
        return (order == .orderedSame)
    }
}

My app compiles fine and works as intended. However, #Preview is failing to build the preview, erroring with:

    CompileDylibError: Failed to build DayRow.swift
    
    Compiling failed: ambiguous use of operator '=='
    
    @__swiftmacro_45test_calendarview_PreviewReplacement_DayRow_133_EA4566EE578D744A3A6BCC599B1B43AALl0C0fMf_.swift
    ------------------------------
    @available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, xrOS 1.0, *)
    struct $s45test_calendarview_PreviewReplacement_DayRow_133_EA4566EE578D744A3A6BCC599B1B43AALl0C0fMf_15PreviewRegistryfMu_: DeveloperToolsSupport.PreviewRegistry {
        static let fileID: String = "test_calendarview_PreviewReplacement_DayRow_1/DayRow.1.preview-thunk.swift"
        static let line: Int = 160
        static let column: Int = 1
    
        static func makePreview() throws -> DeveloperToolsSupport.Preview {
            DeveloperToolsSupport.Preview {
                @State var gDayCalTable = DayCalTable().addDummyData()
                @State var gSelection = Selection()
    
                return DayRow(records: gDayCalTable.records, date: Date(year: 2024, month: 1, day: 17), month: Date(), row: 0, dragCurrent: nil, dragLine: nil)
                    .frame(width: 100, height: 20)
                    .environment(gDayCalTable)
                    .environment(gSelection)
                    .padding(40)
                    .foregroundColor(.white)
            }
        }
    }
    ------------------------------
    /Users/antoine/xcode/_test/test_calendarview/test_calendarview/DayRow.swift:43:50: error: ambiguous use of operator '=='
            let isStart = isRange ? (dayrange!.start == date) : __designTimeBoolean("#2514.[2].[12].property.[0].[5].value.else", fallback: false)
                                                     ^
    /Users/antoine/xcode/_test/test_calendarview/test_calendarview/Extensions/Date.swift:31:17: note: found this candidate
        static func ==(lhs: Date, rhs: Date) -> Bool {
                    ^
    Foundation.Date:22:24: note: found this candidate
        public static func == (lhs: Date, rhs: Date) -> Bool
                           ^

Is there something special I need to tell #Preview to have it compile successfully?

#Preview Compiling failed: ambiguous use of operator '=='
 
 
Q