|
|
@@ -24,11 +24,15 @@ final class BirthdayViewModel: ObservableObject {
|
|
|
@Published private(set) var birthday: Birthday?
|
|
|
/// Computed property calculating the number of days until the current user's birthday.
|
|
|
var daysUntilBirthday: String {
|
|
|
- guard let bday = birthday?.date else { return "No birthday" }
|
|
|
+ guard let bday = birthday?.date else {
|
|
|
+ return NSLocalizedString("No birthday", comment: "User has no birthday")
|
|
|
+ }
|
|
|
let now = Date()
|
|
|
let calendar = Calendar.autoupdatingCurrent
|
|
|
let dayComps = calendar.dateComponents([.day], from: now, to: bday)
|
|
|
- guard let days = dayComps.day else { return "No birthday" }
|
|
|
+ guard let days = dayComps.day else {
|
|
|
+ return NSLocalizedString("No birthday", comment: "User has no birthday")
|
|
|
+ }
|
|
|
return String(days)
|
|
|
}
|
|
|
private var cancellable: AnyCancellable?
|