From 91b31255e621ea144b718980c0912d281d2f4fe4 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Fri, 3 Jan 2025 01:28:07 -0800 Subject: [PATCH] Notification: Fix album date assignment The NSCalendar assignment should have a placeholder month and day of January 1st, instead of the invalid month/day of 0/0. Also, even if this somehow fails, don't attempt to assign it if it returns nil. Signed-off-by: Christopher Snowhill --- Application/PlaybackController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index dfcdd836f..55359c326 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -948,8 +948,10 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) { if(entry.year) { // If PlaylistEntry can represent a full date like some tag formats can do, change it NSCalendar *calendar = [NSCalendar currentCalendar]; - NSDate *releaseYear = [calendar dateWithEra:1 year:entry.year month:0 day:0 hour:0 minute:0 second:0 nanosecond:0]; - [songInfo setObject:releaseYear forKey:MPMediaItemPropertyReleaseDate]; + NSDate *releaseYear = [calendar dateWithEra:1 year:entry.year month:1 day:1 hour:0 minute:0 second:0 nanosecond:0]; + if(releaseYear) { + [songInfo setObject:releaseYear forKey:MPMediaItemPropertyReleaseDate]; + } } [songInfo setObject:@(entry.currentPosition) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime]; [songInfo setObject:entry.length forKey:MPMediaItemPropertyPlaybackDuration];