Swift:
let playGround = PlayGround()
print(playGround.getCurrentTimeStamp())
// at 6:09 the output was 6:9, it should be 6:09
print(playGround.getFutureInXMin(extra_minutes: 60))
// shows minutes + 60 instead of the time in 60 minutes
print("getPastInXMin")
print(playGround.getPastInXMin(less_minutes: 5)) // adds instead of subtract
print(playGround.getPastInXMin(less_minutes: 70))
// instead of showing the time 70 minutes AGO it adds minutes to the param
print(playGround.getGMT())
// GMT is the counries time value used to calculate time
// differences between different countries
// mine should output 2 not 2022-06-24 18:06:48 +0000
also please note I corrected the small to big func :
Swift:
func smallToBig(_ a:Int...) -> Bool {
for i in 0..<a.count {
guard i + 1 < a.count else {
return true
}
if a[i] > a[i + 1] {
return false
}
}
return true
}
Swift:
func partOfDay() -> String {
// '''This method returns which part of the day it is (morning, ...)'''
let hour: Int = self.getHoursAsInt()
if self.smallToBig(5, hour, 12) {
return "morning"
} else if self.smallToBig(11, hour, 17) {
return "afternoon"
} else if self.smallToBig(16, hour, 21) {
return "evening"
} else { return "night"
}
}