From d2a0f207ffc17275ff060b6a767e8d86148ef06d Mon Sep 17 00:00:00 2001 From: nixzhu Date: Mon, 3 Aug 2015 17:21:32 +0800 Subject: [PATCH] time format --- .../DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift | 4 ++-- .../Notifications/NotificationsViewController.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Yep/ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift b/Yep/ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift index 0af2cd8b..a3075175 100644 --- a/Yep/ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift +++ b/Yep/ViewControllers/DoNotDisturbPeriod/DoNotDisturbPeriodViewController.swift @@ -94,10 +94,10 @@ extension DoNotDisturbPeriodViewController: UIPickerViewDataSource, UIPickerView func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! { if component == 0 { - return "\(row % 24)" + return String(format: "%02d", row % 24) } else if component == 1 { - return "\(row % 60)" + return String(format: "%02d", row % 60) } return "" diff --git a/Yep/ViewControllers/Notifications/NotificationsViewController.swift b/Yep/ViewControllers/Notifications/NotificationsViewController.swift index e0edf343..ed725fa4 100644 --- a/Yep/ViewControllers/Notifications/NotificationsViewController.swift +++ b/Yep/ViewControllers/Notifications/NotificationsViewController.swift @@ -18,10 +18,10 @@ struct DoNotDisturbPeriod { var toMinute: Int = 30 var fromString: String { - return "\(fromHour):\(fromMinute)" + return String(format: "%02d:%02d", fromHour, fromMinute) } var toString: String { - return "\(toHour):\(toMinute)" + return String(format: "%02d:%02d", toHour, toMinute) } }