ashikahmad / PrayerTimes-Swift

Islamic Prayer (salah) Time calculation written in swift.
61 stars 21 forks source link

When Hours become 00 there is issue in AM/PM #7

Open aqkhana2002 opened 5 years ago

aqkhana2002 commented 5 years ago

i am living in sydney and Zohar calculation is showing 00:58 AM , any idea ?

aqkhana2002 commented 5 years ago

Bug Fixed in code ...

/// Convert float hours to 12h format func floatToTime12(_ time:Double, noSuffix:Bool)->String { if let (hours, minutes) = floatToHourMinute(time) { return NSString(format: "%02d:%02d%@", (hours % 12), minutes, (noSuffix ? "" : ((hours > 12) ? " pm" : " am")) ) as String } else { return "---" } }

Changed to

/// Convert float hours to 12h format func floatToTime12(_ time:Double, noSuffix:Bool)->String { if let (hours, minutes) = floatToHourMinute(time) { return NSString(format: "%02d:%02d%@", (hours % 12==0 ? 12 : hours % 12 ), minutes, (noSuffix ? "" : ((hours >= 12) ? " pm" : " am")) ) as String } else { return "---" } }