Skip to content

Commit

Permalink
Fix failing test for 24 hr locales (#44)
Browse files Browse the repository at this point in the history
This test was failing for me. I use en-US locale, but I set my clock to
24 hour. It's admittedly uncommon, but I'd wager this test is failing
for anyone in a non-12 hours locale.

To be honest, I expected the existing date format string `hh:mm a` to be
sufficient, but apparently its not.
  • Loading branch information
michaelkirk authored May 24, 2024
1 parent 3eda169 commit 8f0bacd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MapboxNavigationTests/Sources/Tests/StyleManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ class StyleManagerTests: XCTestCase {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "hh:mm a"
dateFormatter.timeZone = TimeZone(identifier: "PST")

dateFormatter.locale = Locale(identifier: "en_US")

NSTimeZone.default = NSTimeZone(abbreviation: "PST")! as TimeZone

let beforeSunrise = dateFormatter.date(from: "05:00 AM")!
Expand Down

0 comments on commit 8f0bacd

Please sign in to comment.