Skip to content

Commit 6599bea

Browse files
committed
fixes to dates on ios app, among other updates
1 parent 33c44c8 commit 6599bea

21 files changed

+136
-701
lines changed

ios/ConArtist.xcodeproj/project.pbxproj

Lines changed: 33 additions & 540 deletions
Large diffs are not rendered by default.

ios/ConArtist.xcodeproj/xcshareddata/xcschemes/ConArtist DEV.xcscheme

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1600"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -10,7 +10,7 @@
1010
buildForTesting = "YES"
1111
buildForRunning = "YES"
1212
buildForProfiling = "YES"
13-
buildForArchiving = "YES"
13+
buildForArchiving = "NO"
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
@@ -29,17 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<MacroExpansion>
33-
<BuildableReference
34-
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "326B7E0021FEA52B00E8DF34"
36-
BuildableName = "ConArtist DEV.app"
37-
BlueprintName = "ConArtist DEV"
38-
ReferencedContainer = "container:ConArtist.xcodeproj">
39-
</BuildableReference>
40-
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
4332
</TestAction>
4433
<LaunchAction
4534
buildConfiguration = "Debug"
@@ -55,14 +44,12 @@
5544
runnableDebuggingMode = "0">
5645
<BuildableReference
5746
BuildableIdentifier = "primary"
58-
BlueprintIdentifier = "326B7E0021FEA52B00E8DF34"
59-
BuildableName = "ConArtist DEV.app"
60-
BlueprintName = "ConArtist DEV"
47+
BlueprintIdentifier = "321B75D51F9BAD320055EBC4"
48+
BuildableName = "ConArtist.app"
49+
BlueprintName = "ConArtist"
6150
ReferencedContainer = "container:ConArtist.xcodeproj">
6251
</BuildableReference>
6352
</BuildableProductRunnable>
64-
<AdditionalOptions>
65-
</AdditionalOptions>
6653
</LaunchAction>
6754
<ProfileAction
6855
buildConfiguration = "Release"

ios/ConArtist.xcodeproj/xcshareddata/xcschemes/ConArtist.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0930"
3+
LastUpgradeVersion = "1600"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict/>
5+
</plist>

ios/ConArtist/Model/Convention.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,24 +369,24 @@ extension Convention {
369369
}
370370

371371
var isStarted: Bool {
372-
return start.changeTimeZone(from: TimeZone.UTC, to: .current) <= Date().roundToDay()
372+
return Date().changeTimeZone(from: .UTC, to: .autoupdatingCurrent) > start
373373
}
374374

375375
var isEnded: Bool {
376-
return end.changeTimeZone(from: TimeZone.UTC, to: .current) < Date().roundToDay()
376+
return Date().changeTimeZone(from: .UTC, to: .autoupdatingCurrent) > end
377377
}
378378
}
379379

380380
// MARK: - Date formatting
381381
extension Convention {
382-
static var DateFormat: String { return "MMM. d, yyyy"¡ }
383-
384382
var dateString: String {
385383
get { return Convention.formatDateRange(start: self.start, end: self.end) }
386384
}
387385

388386
static func formatDateRange(start: Date, end: Date) -> String {
389-
return "{} - {}"¡ % start.toString(Convention.DateFormat, timeZone: .UTC) % end.toString(Convention.DateFormat, timeZone: .UTC)
387+
var format = Date.FormatStyle.dateTime.month(.abbreviated).day(.defaultDigits).year(.defaultDigits)
388+
format.timeZone = .UTC
389+
return "{} - {}"¡ % start.formatted(format) % end.formatted(format)
390390
}
391391
}
392392

ios/ConArtist/Model/ConventionExtraInfo.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ enum ConventionExtraInfo: Codable {
2828
case city
2929
}
3030

31-
static var HourFormat: String { return "h:mma"¡ }
32-
static var ShortHourFormat: String { return "h:mm"¡ }
33-
static var ShortDayFormat: String { return "EEE"¡ }
31+
static var HourFormat: Date.FormatStyle { return Date.FormatStyle().hour(.defaultDigits(amPM: .abbreviated)).minute(.twoDigits) }
32+
static var ShortHourFormat: Date.FormatStyle { return Date.FormatStyle().hour(.defaultDigits(amPM: .omitted)).minute(.twoDigits) }
33+
static var ShortDayFormat: Date.FormatStyle { return Date.FormatStyle().weekday(.abbreviated) }
3434

3535
case Hours([(Date, Date)])
3636
case Dates(Date, Date)
@@ -76,9 +76,9 @@ enum ConventionExtraInfo: Codable {
7676
return hours
7777
.map { open, close in
7878
"{} {} - {}"¡
79-
% open.toString(ConventionExtraInfo.ShortDayFormat)
80-
% open.toString(ConventionExtraInfo.HourFormat)
81-
% close.toString(ConventionExtraInfo.HourFormat)
79+
% open.formatted(ConventionExtraInfo.ShortDayFormat)
80+
% open.formatted(ConventionExtraInfo.HourFormat)
81+
% close.formatted(ConventionExtraInfo.HourFormat)
8282
}
8383
.joined(separator: "\n")
8484
case .Dates(let start, let end):

ios/ConArtist/Scenes/Convention List/ConventionListViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ extension ConventionListViewController {
129129
.asObservable()
130130
.share(replay: 1)
131131
let past = conventions
132-
.map { cons in cons.filter { $0.end < Date.today() } }
132+
.map { cons in cons.filter { $0.isEnded } }
133133
.map { cons in cons.sorted { $0.start > $1.start } }
134134
let present = conventions
135-
.map { cons in cons.filter { $0.start <= Date.today() && $0.end >= Date.today() } }
135+
.map { cons in cons.filter { con in con.isStarted && !con.isEnded } }
136136
let future = conventions
137-
.map { cons in cons.filter { $0.start > Date.today() } }
137+
.map { cons in cons.filter { con in !con.isStarted && !con.isEnded } }
138138
.map { cons in cons.sorted { $0.start < $1.start } }
139139

140140
past.subscribe(onNext: { [weak self] in self?.past = $0 }).disposed(by: disposeBag)

ios/ConArtist/Scenes/Convention List/ConventionTableViewCell.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class ConventionTableViewCell: ConArtistTableViewCell {
4545
if case .Hours(let hours)? = hours,
4646
let (open, close) = hours.first(where: { start, end in start.roundToDay() == Date().roundToDay()}) {
4747
timeLabel?.text = "{} - {}"¡
48-
% open.toString(ConventionExtraInfo.ShortHourFormat)
49-
% close.toString(ConventionExtraInfo.ShortHourFormat)
48+
% open.formatted(ConventionExtraInfo.ShortHourFormat)
49+
% close.formatted(ConventionExtraInfo.ShortHourFormat)
5050
} else {
5151
timeLabel?.text = ""
5252
}

ios/ConArtist/Scenes/Record List/Overlays/ExpenseDetailsOverlayViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ extension ExpenseDetailsOverlayViewController {
102102
categoryLabel.text = expense.category
103103
amountLabel.font = amountLabel.font.usingFeatures([.tabularFigures])
104104
amountLabel.text = expense.price.toString()
105-
timeLabel.text = expense.time.toString("EEEE MMMM d, yyyy. h:mm a"¡)
105+
timeLabel.text = expense.time.formatted(date: .complete, time: .shortened)
106106
noteLabel.text = expense.description.isEmpty ? "Nothing to say..."¡ : expense.description
107107
noteLabel.textColor = expense.description.isEmpty ? .textPlaceholder : .text
108108
backgroundButton.alpha = 0

ios/ConArtist/Scenes/Record List/Overlays/RecordDetailsOverlayViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ extension RecordDetailsOverlayViewController {
141141
}
142142
amountLabel.font = amountLabel.font.usingFeatures([.tabularFigures])
143143
amountLabel.text = record.price.toString()
144-
timeLabel.text = record.time.toString("EEEE MMMM d, yyyy. h:mm a"¡)
144+
timeLabel.text = record.time.formatted(date: .complete, time: .shortened)
145145
noteLabel.text = record.info.isEmpty ? "Nothing to say..."¡ : record.info
146146
noteLabel.textColor = record.info.isEmpty ? .textPlaceholder : .text
147147
backgroundButton.alpha = 0
@@ -151,7 +151,7 @@ extension RecordDetailsOverlayViewController {
151151
.reduce(0, +)
152152
itemsTableViewHeightConstraint.constant = height
153153
navBar.title = convention?.name ?? "Sale"¡
154-
navBar.subtitle = after?.toString("MMM. d, yyyy"¡)
154+
navBar.subtitle = after?.formatted(date: .abbreviated, time: .omitted)
155155
navBar.layer.shadowOpacity = 0
156156
itemsTableView.reloadData()
157157
}

0 commit comments

Comments
 (0)