From 80140729de9db9f7746d7933f59c94ad0f39acc7 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 30 Jan 2021 13:34:17 -0600 Subject: [PATCH] Truncating hour/min differences. --- Clocker/ClockerUnitTests/ClockerUnitTests.swift | 6 +++--- .../DateTools.bundle/en.lproj/DateTools.strings | 2 +- Clocker/Panel/Data Layer/TimezoneDataOperations.swift | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Clocker/ClockerUnitTests/ClockerUnitTests.swift b/Clocker/ClockerUnitTests/ClockerUnitTests.swift index 7844565..ce56fda 100644 --- a/Clocker/ClockerUnitTests/ClockerUnitTests.swift +++ b/Clocker/ClockerUnitTests/ClockerUnitTests.swift @@ -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())") } diff --git a/Clocker/Dependencies/Date Additions/DateTools.bundle/en.lproj/DateTools.strings b/Clocker/Dependencies/Date Additions/DateTools.bundle/en.lproj/DateTools.strings index dc4cfa9..26bf37b 100755 --- a/Clocker/Dependencies/Date Additions/DateTools.bundle/en.lproj/DateTools.strings +++ b/Clocker/Dependencies/Date Additions/DateTools.bundle/en.lproj/DateTools.strings @@ -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"; diff --git a/Clocker/Panel/Data Layer/TimezoneDataOperations.swift b/Clocker/Panel/Data Layer/TimezoneDataOperations.swift index 7d3dae6..e599958 100644 --- a/Clocker/Panel/Data Layer/TimezoneDataOperations.swift +++ b/Clocker/Panel/Data Layer/TimezoneDataOperations.swift @@ -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() }