Skip to content

Commit f21dd63

Browse files
author
Alessio Arsuffi
committed
fix date tests 4
1 parent 39d1cd4 commit f21dd63

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Marvin/Date/Date.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ public extension Date {
3636
/// - format: Date format (ex: "yyyy mm dd")
3737
/// default: yyyy mm dd
3838
/// - locale: locale identifier, default "it_IT"
39+
/// - timezone: timezone identifier, default: "UTC"
3940
/// - Returns: a string from date
40-
public func string(dateFormat format: String? = "yyyy MM dd", locale: String = "it_IT") -> String {
41+
public func string(dateFormat format: String? = "yyyy MM dd", locale: String = "it_IT", timezone: String = "UTC") -> String {
4142
let dateFormatter = DateFormatter()
4243
dateFormatter.locale = Locale(identifier: locale)
44+
dateFormatter.timeZone = TimeZone(identifier: timezone)
4345
dateFormatter.dateFormat = format
4446
return dateFormatter.string(from: self)
4547
}

MarvinTests/Date/DateTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ class DateTests: XCTestCase {
9393
}
9494

9595
let dateString = date.string(dateFormat: "yyyy MM dd HH:mm:ss")
96-
XCTAssertEqual(dateString, "2017 11 17 12:55:02")
96+
XCTAssertEqual(dateString, "2017 11 17 11:55:02")
9797
}
9898
}

0 commit comments

Comments
 (0)