Fixed Bug: Currencly removal from string could destroy date
This commit is contained in:
parent
58cf8809ad
commit
afeee78836
4
meuro.py
4
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")+':')
|
||||
|
Loading…
Reference in New Issue
Block a user