Mise à jour de GitLab prévue ce samedi 23 octobre 2021 à partir de 9h00 CET

Commit a838f973 authored by matograine's avatar matograine
Browse files

* check if the date is not passed

parent ebf80343
......@@ -4,12 +4,23 @@ import json
from utils.constants import DEFAULT_FOLDER, WALLETS_FOLDER, BACKUP_FOLDER, CONF_FILE
def check_date(given_date):
infos_date = given_date.split("/")
if len(infos_date) != 3 or len(infos_date[2]) != 4 or len(infos_date[0]) != 2 or len(infos_date[1]) != 2:
print ("Erreur : le champs <date> doit être de forme JJ/MM/YYYY")
exit
today = datetime.datetime.now()
date = datetime.datetime(int(infos_date[2]), int(infos_date[1]), int(infos_date[0]))
if today > date:
while True:
answer = input("La date donnée est passée. Voulez-vous continuer (o/n) ? : ")
if answer == "n" or answer == "N":
print ("Veuillez recommencer.")
exit(0)
elif answer != "o":
print ("La réponse est \"o\" ou \"n\" !")
else:
break
return datetime.date(int(infos_date[2]), int(infos_date[1]), int(infos_date[0]))
class CheckConfig():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment