Skip to content

Commit

Permalink
Fix ISO date format (#1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinswart authored Sep 25, 2020
1 parent ba0f64d commit 3bbb921
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion KsApi/extensions/DateFormatter+ISOFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import Foundation
extension DateFormatter {
static var isoDateFormatter: DateFormatter {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-DD"
dateFormatter.dateFormat = "yyyy-MM-dd"
dateFormatter.timeZone = TimeZone.init(secondsFromGMT: 0)
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
return dateFormatter
}
}
8 changes: 5 additions & 3 deletions KsApi/models/graphql/adapters/Reward+GraphRewardTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class Reward_GraphRewardTests: XCTestCase {

let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
dateFormatter.dateFormat = "yyyy-MM-DD"
dateFormatter.dateFormat = "yyyy-MM-dd"

let v1Reward = Reward.reward(
from: reward,
Expand All @@ -29,7 +29,7 @@ final class Reward_GraphRewardTests: XCTestCase {
XCTAssertEqual(v1Reward?.convertedMinimum, 180.0)
XCTAssertEqual(v1Reward?.description, "Description")
XCTAssertEqual(v1Reward?.endsAt, 1_887_502_131)
XCTAssertEqual(v1Reward?.estimatedDeliveryOn, 1_577_836_800.0)
XCTAssertEqual(v1Reward?.estimatedDeliveryOn, 1_596_240_000.0)
XCTAssertEqual(v1Reward?.id, 1)
XCTAssertEqual(v1Reward?.limit, 5)
XCTAssertEqual(v1Reward?.minimum, 159.0)
Expand All @@ -46,6 +46,8 @@ final class Reward_GraphRewardTests: XCTestCase {
}

func testTemplate() {
XCTAssertNotNil(Reward.reward(from: .template, projectId: 12_345))
let reward = Reward.reward(from: .template, projectId: 12_345)
XCTAssertNotNil(reward)
XCTAssertEqual(reward?.estimatedDeliveryOn, 1_596_240_000.0)
}
}

0 comments on commit 3bbb921

Please # to comment.