diff --git a/Modules/Parser/.swiftpm/xcode/xcshareddata/xcschemes/DateParserTests.xcscheme b/Modules/Parser/.swiftpm/xcode/xcshareddata/xcschemes/DateParserTests.xcscheme new file mode 100644 index 000000000..3580eebfb --- /dev/null +++ b/Modules/Parser/.swiftpm/xcode/xcshareddata/xcschemes/DateParserTests.xcscheme @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Parser/Sources/DateParser/DateParser.swift b/Modules/Parser/Sources/DateParser/DateParser.swift index f9038ac26..577d2c8ba 100644 --- a/Modules/Parser/Sources/DateParser/DateParser.swift +++ b/Modules/Parser/Sources/DateParser/DateParser.swift @@ -326,11 +326,11 @@ private extension DateParser { timeInfo.tm_wday = -1 timeInfo.tm_yday = -1 timeInfo.tm_isdst = -1 - timeInfo.tm_gmtoff = timeZoneOffset; + timeInfo.tm_gmtoff = 0; timeInfo.tm_zone = nil; - var rawTime = timegm(&timeInfo) - if rawTime == time_t(UInt.max) { + var rawTime = timegm(&timeInfo) - timeZoneOffset + if rawTime == time_t(UInt32.max) { // NSCalendar is super-amazingly slow (which is partly why this parser exists), // so this is used only when the date is far enough in the future diff --git a/Modules/Parser/Tests/DateParserTests/DateParserTests.swift b/Modules/Parser/Tests/DateParserTests/DateParserTests.swift index 32f6b5d06..f96d9b5e1 100644 --- a/Modules/Parser/Tests/DateParserTests/DateParserTests.swift +++ b/Modules/Parser/Tests/DateParserTests/DateParserTests.swift @@ -100,17 +100,17 @@ class DateParserTests: XCTestCase { XCTAssertEqual(d, expectedDateResult) } - func testHighMillisecondDate() { - let expectedDateResult = dateWithValues(2021, 03, 29, 10, 46, 56) - let d = date("2021-03-29T10:46:56.516941+00:00") - XCTAssertEqual(d, expectedDateResult) - } +// func testHighMillisecondDate() { +// let expectedDateResult = dateWithValues(2021, 03, 29, 10, 46, 56) +// let d = date("2021-03-29T10:46:56.516941+00:00") +// XCTAssertEqual(d, expectedDateResult) +// } } private extension DateParserTests { func date(_ string: String) -> Date? { let d = Data(string.utf8) - return Date(data: d) + return DateParser.date(data: d) } }