Browse Source

Truncating hour/min differences.

pull/92/head
Abhishek 4 years ago
parent
commit
80140729de
  1. 6
      Clocker/ClockerUnitTests/ClockerUnitTests.swift
  2. 2
      Clocker/Dependencies/Date Additions/DateTools.bundle/en.lproj/DateTools.strings
  3. 2
      Clocker/Panel/Data Layer/TimezoneDataOperations.swift

6
Clocker/ClockerUnitTests/ClockerUnitTests.swift

@ -130,10 +130,10 @@ class ClockerUnitTests: XCTestCase {
// The below test might fail outside California or if DST is active! // The below test might fail outside California or if DST is active!
// CI is calibrated to be on LA timezone! // CI is calibrated to be on LA timezone!
func testTimeDifference() { func testTimeDifference() {
XCTAssertTrue(operations.timeDifference() == ", 11 hours 30 mins ahead", "Difference was unexpectedly: \(operations.timeDifference())") XCTAssertTrue(operations.timeDifference() == ", 11h 30m ahead", "Difference was unexpectedly: \(operations.timeDifference())")
XCTAssertTrue(californiaOperations.timeDifference() == ", 2 hours behind", "Difference was unexpectedly: \(californiaOperations.timeDifference())") XCTAssertTrue(californiaOperations.timeDifference() == ", 2h behind", "Difference was unexpectedly: \(californiaOperations.timeDifference())")
XCTAssertTrue(floridaOperations.timeDifference() == ", an hour ahead", "Difference was unexpectedly: \(floridaOperations.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())") XCTAssertTrue(omahaOperations.timeDifference() == "", "Difference was unexpectedly: \(omahaOperations.timeDifference())")
} }

2
Clocker/Dependencies/Date Additions/DateTools.bundle/en.lproj/DateTools.strings

@ -2,7 +2,7 @@
"%d days ago" = "%d days ago"; "%d days ago" = "%d days ago";
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"%d hours ago" = "%d hours ago"; "%d hours ago" = "%dh ago";
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"%d minutes ago" = "%d minutes ago"; "%d minutes ago" = "%d minutes ago";

2
Clocker/Panel/Data Layer/TimezoneDataOperations.swift

@ -328,7 +328,7 @@ extension TimezoneDataOperations {
} }
let minuteDifference = calculateTimeDifference(with: local as NSDate, timezoneDate: timezoneDate as NSDate) 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() return replaceAgo.lowercased()
} }

Loading…
Cancel
Save