code change, Date.toString has now two parameters for date and time style.
This commit is contained in:
parent
ae5f1f16b7
commit
52d490d204
|
@ -47,11 +47,11 @@ extension Date {
|
|||
return dateFormatter.string(from: self).appending("Z")
|
||||
}
|
||||
|
||||
/// date to short string, according to locale
|
||||
func toShortString() -> String {
|
||||
/// date to string, with date and time as specified by one of the values in DateFormatter.Style
|
||||
func toString(timeStyle: DateFormatter.Style, dateStyle: DateFormatter.Style) -> String {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.timeStyle = .short
|
||||
dateFormatter.dateStyle = .short
|
||||
dateFormatter.timeStyle = timeStyle
|
||||
dateFormatter.dateStyle = dateStyle
|
||||
return dateFormatter.string(from: self)
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ class Trace {
|
|||
// timestamp app launch
|
||||
// unwrap timeStampAppLaunch
|
||||
if let timeStampAppLaunch = UserDefaults.standard.timeStampAppLaunch {
|
||||
traceInfo.appendStringAndNewLine("App launched at " + timeStampAppLaunch.toShortString() + " local time.")
|
||||
traceInfo.appendStringAndNewLine("App launched at " + timeStampAppLaunch.toString(timeStyle: .short, dateStyle: .short) + " local time.")
|
||||
}
|
||||
|
||||
// cgm transmitter type from UserDefaults
|
||||
|
|
|
@ -975,7 +975,7 @@ extension BluetoothPeripheralViewController: UITableViewDataSource, UITableViewD
|
|||
|
||||
}
|
||||
|
||||
cell.detailTextLabel?.text = lastConnectionStatusChangeTimeStamp.toShortString()
|
||||
cell.detailTextLabel?.text = lastConnectionStatusChangeTimeStamp.toString(timeStyle: .short, dateStyle: .short)
|
||||
|
||||
} else {
|
||||
cell.textLabel?.text = Texts_BluetoothPeripheralView.connectedAt
|
||||
|
|
|
@ -235,7 +235,7 @@ extension DexcomG5BluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
|||
if let lastResetTimeStamp = dexcomG5.lastResetTimeStamp {
|
||||
|
||||
cell.textLabel?.text = Texts_BluetoothPeripheralView.lastResetTimeStamp
|
||||
cell.detailTextLabel?.text = lastResetTimeStamp.toShortString()
|
||||
cell.detailTextLabel?.text = lastResetTimeStamp.toString(timeStyle: .short, dateStyle: .short)
|
||||
cell.accessoryType = .none
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue