To handle dates beyond the typical range supported by Python;s built-in datetime module(which is limited to years 1 through 9999),you can use the datetime library's datetime class for calculations,but for years beyond that, you might consider using custom classes or libraries that can handle arbitrary ranges.
Custom Date Class : To handle dates with random years, your could write own class. Here is a basic example: