From afeee788366f3166050f4b7d6700996291d9746c Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sat, 30 Oct 2021 14:35:03 +0200 Subject: [PATCH] Fixed Bug: Currencly removal from string could destroy date --- meuro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meuro.py b/meuro.py index c870b04..c256015 100755 --- a/meuro.py +++ b/meuro.py @@ -107,14 +107,14 @@ def cliInterface(): reFromMeur = re.compile(r'(\d+(.\d\d)?)\W?(μ|m|M)') if (m := reFromEur.search(arg))!=None: eurS = m.groups()[0] - date = _extractDate(arg.replace(eurS, '-')) + date = _extractDate(arg[:m.span()[0]] + '-' + arg[m.span()[1]:]) eur = float(eurS) meur = euroToMeuro(eur, date) print('Exchange rate for '+date.strftime("%d.%m.%Y at %H:%M")+':') print(f'{eur:.2f}€ = {meur:.2f}µ') elif (m:= reFromMeur.search(arg))!=None: meurS = m.groups()[0] - date = _extractDate(arg.replace(meurS, '-')) + date = _extractDate(arg[:m.span()[0]] + '-' + arg[m.span()[1]:]) meur = float(meurS) eur = meuroToEuro(meur, date) print('Exchange rate for '+date.strftime("%d.%m.%Y at %H:%M")+':')