Skip to content

Commit

Permalink
Truncating hour/min differences.
Browse files Browse the repository at this point in the history
  • Loading branch information
n0shake committed Jan 30, 2021
1 parent f343c9e commit 8014072
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Clocker/ClockerUnitTests/ClockerUnitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ class ClockerUnitTests: XCTestCase {
// The below test might fail outside California or if DST is active!
// CI is calibrated to be on LA timezone!
func testTimeDifference() {
XCTAssertTrue(operations.timeDifference() == ", 11 hours 30 mins ahead", "Difference was unexpectedly: \(operations.timeDifference())")
XCTAssertTrue(californiaOperations.timeDifference() == ", 2 hours behind", "Difference was unexpectedly: \(californiaOperations.timeDifference())")
XCTAssertTrue(operations.timeDifference() == ", 11h 30m ahead", "Difference was unexpectedly: \(operations.timeDifference())")
XCTAssertTrue(californiaOperations.timeDifference() == ", 2h behind", "Difference was unexpectedly: \(californiaOperations.timeDifference())")
XCTAssertTrue(floridaOperations.timeDifference() == ", an hour ahead", "Difference was unexpectedly: \(floridaOperations.timeDifference())")
XCTAssertTrue(aucklandOperations.timeDifference() == ", 19 hours ahead", "Difference was unexpectedly: \(aucklandOperations.timeDifference())")
XCTAssertTrue(aucklandOperations.timeDifference() == ", 19h ahead", "Difference was unexpectedly: \(aucklandOperations.timeDifference())")
XCTAssertTrue(omahaOperations.timeDifference() == "", "Difference was unexpectedly: \(omahaOperations.timeDifference())")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"%d days ago" = "%d days ago";

/* No comment provided by engineer. */
"%d hours ago" = "%d hours ago";
"%d hours ago" = "%dh ago";

/* No comment provided by engineer. */
"%d minutes ago" = "%d minutes ago";
Expand Down
2 changes: 1 addition & 1 deletion Clocker/Panel/Data Layer/TimezoneDataOperations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ extension TimezoneDataOperations {
}

let minuteDifference = calculateTimeDifference(with: local as NSDate, timezoneDate: timezoneDate as NSDate)
minuteDifference == 0 ? replaceAgo.append("ahead") : replaceAgo.append("\(minuteDifference) mins ahead")
minuteDifference == 0 ? replaceAgo.append("ahead") : replaceAgo.append("\(minuteDifference)m ahead")
return replaceAgo.lowercased()
}

Expand Down

0 comments on commit 8014072

Please sign in to comment.