Skip to content

Commit

Permalink
Add DOB entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
yspreen committed Apr 21, 2021
1 parent 4d09682 commit e9288ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions PatientScannerDemo/Extensions/Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ extension Date {
}
self = date
}

var localDateString: String {
let formatter = DateFormatter()
formatter.locale = .current
formatter.timeStyle = .none
formatter.dateStyle = .medium
return formatter.string(from: self)
}
}
10 changes: 8 additions & 2 deletions PatientScannerDemo/Models/HCert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,15 @@ struct HCert {
}

var info: [InfoSection] {
[
InfoSection(header: "Certificate Type", content: type.rawValue)
var info = [
InfoSection(header: "Certificate Type", content: type.rawValue),
] + personIdentifiers
if let date = dateOfBirth {
info += [
InfoSection(header: "Date of Birth", content: date.localDateString),
]
}
return info
}

var header: JSON
Expand Down

0 comments on commit e9288ec

Please sign in to comment.