41 lines
1.1 KiB
Python
Executable File
41 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
"""
|
|
Calculates the number of actual days since everyone
|
|
went into hiding (quarantine).
|
|
"""
|
|
|
|
import argparse
|
|
import datetime
|
|
import dateutil.parser
|
|
|
|
try:
|
|
import color
|
|
except:
|
|
print("Unable to import the color library. No colors for you.")
|
|
|
|
|
|
quarantine_start_date = "13 Mar 2020"
|
|
|
|
def parse_args():
|
|
argp = argparse.ArgumentParser()
|
|
return argp.parse_args()
|
|
|
|
def quarantine_days(quarantine_start_date=quarantine_start_date):
|
|
q_count = datetime.datetime.now() - dateutil.parser.parse(quarantine_start_date)
|
|
return q_count.days
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# args = parse_args()
|
|
try:
|
|
start_date_message = f"\nQuarantine Start Date: {color.yellow(quarantine_start_date)}"
|
|
quarantine_days_message = f"Quarantine Days: {color.red(quarantine_days(quarantine_start_date))}"
|
|
except ModuleNotFoundError:
|
|
start_date_message = f"\nQuarantine Start Date: {quarantine_start_date}"
|
|
quarantine_days_message = f"Quarantine Days: {quarantine_days(quarantine_start_date)}"
|
|
|
|
print(start_date_message)
|
|
print(quarantine_day_message)
|
|
|