Handle dates outside Python's range
This commit is contained in:
parent
876ccaf8d2
commit
e8d305a5d2
@ -75,7 +75,10 @@ def album_sort_release(
|
|||||||
all_albums = list(albums)
|
all_albums = list(albums)
|
||||||
|
|
||||||
def _sort_key(album: SearchAlbum) -> date:
|
def _sort_key(album: SearchAlbum) -> date:
|
||||||
|
try:
|
||||||
return parse_release_date(album.release_date, album.release_date_precision, fast_forward=fast_forward)
|
return parse_release_date(album.release_date, album.release_date_precision, fast_forward=fast_forward)
|
||||||
|
except ValueError:
|
||||||
|
return date(1970, 1, 1)
|
||||||
|
|
||||||
for album in sorted(all_albums, key=_sort_key, reverse=descending):
|
for album in sorted(all_albums, key=_sort_key, reverse=descending):
|
||||||
yield album
|
yield album
|
||||||
|
Loading…
Reference in New Issue
Block a user