Open
Description
It seems that the dates are 1 day in the future if the local time is the next day UTC.
Not sure if this is the same problem as reported in #24?
Here is a complete test. Note that the reported times are one day in the future from the correct times.
/// Sun and Moon Data for One Day
///
/// U.S. Naval Observatory
/// Astronomical Applications Department
///
/// (Longitude W 94° 0', Latitude N 39° 0')
///
/// Friday, May 3, 2019 Universal Time - 5h
/// Sun
/// Begin civil twilight 05:47
/// Sunrise 06:16
/// Sun transit 13:13
/// Sunset 20:11
/// End civil twilight 20:40
/// Moon
/// Moonrise 05:56
/// Moon transit 12:24
/// Moonset 19:00
///
/// [https://aa.usno.navy.mil/data/docs/RS_OneDay.php](https://aa.usno.navy.mil/data/docs/RS_OneDay.php)
func testPlainLatLon() {
var tdf: DateFormatter = {
let df = DateFormatter()
df.dateFormat = "MM/dd/yyyy HH:mm zzz"
return df
}()
let testCriticalEvening = tdf.date(from: "05/03/2019 19:20 CDT")!
let testLocation: CLLocation = CLLocation(latitude: 39.00, longitude: -94.0)
let expectedSunrise = "05/03/2019 06:16 CDT"
let expectedSunset = "05/03/2019 20:11 CDT"
let solar = Solar(for: testCriticalEvening, coordinate: testLocation.coordinate)
XCTAssert(tdf.string(from: solar!.sunrise!) == expectedSunrise,
"Expected: \(expectedSunrise), Received: \(tdf.string(from: solar!.sunrise!))")
XCTAssert(tdf.string(from: solar!.sunset!) == expectedSunset,
"Expected: \(expectedSunset), Received: \(tdf.string(from: solar!.sunset!))")
}
The results of the test are:
UI Test Activity:
Assertion Failure: Solar_iOSTests.swift:198: XCTAssertTrue failed - Expected: 05/03/2019 06:16 CDT, Received: 05/04/2019 06:14 CDT
UI Test Activity:
Assertion Failure: Solar_iOSTests.swift:200: XCTAssertTrue failed - Expected: 05/03/2019 20:11 CDT, Received: 05/04/2019 20:11 CDT
Metadata
Metadata
Assignees
Labels
No labels