Skip to content

Commit f5ad669

Browse files
committed
修复倒计时计算问题|打包1.0
1 parent 768fe43 commit f5ad669

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

MainWidget/Widget/CountDown.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ extension Date {
1818
let nowTimeStamp = Int(now.timeIntervalSince1970)
1919
let toDateTimeStamp = Int(toDate.timeIntervalSince1970)
2020
let difference:Double = Double(abs(nowTimeStamp - toDateTimeStamp))
21-
return Int(floor( difference / (86400))) + 1
21+
if(nowTimeStamp < toDateTimeStamp){
22+
return Int(floor( difference / (86400))) + 1
23+
}
24+
else{
25+
return Int(floor( difference / (86400)))
26+
}
27+
2228
}
2329
func dateToString(_ date:Date,dateFormat:String = "yyyy-MM-dd HH:mm:ss") -> String {
2430
let formatter = DateFormatter()

Release/iWidget 1.0.ipa

2.75 MB
Binary file not shown.

0 commit comments

Comments
 (0)