Files
to-hen/epoch/epoch.py

24 lines
654 B
Python
Raw Permalink Normal View History

2023-02-01 09:01:26 +01:00
from datetime import date, timedelta
import sys
epoch_begin = date(2020, 3, 15)
epoch_end = date(2022, 3, 30)
days_within_epoch = epoch_end - epoch_begin
if __name__ == "__main__":
if len(sys.argv[1:]) < 1:
exit(1)
start_date = date.fromisoformat(sys.argv[1])
days_before_epoch = epoch_begin - start_date
days_after_epoch = date.today() - epoch_end
days_outside_epoch = days_before_epoch + days_after_epoch
difference = days_within_epoch - (days_outside_epoch)
print("Days inside epoch:", days_within_epoch)
print("Days outside epoch:", days_outside_epoch)
print("Breakeven", date.today() + difference)