From 529c78bde7bf595c9fbd40b80be5cd85d02592f5 Mon Sep 17 00:00:00 2001 From: DJSchaffner Date: Sat, 19 Sep 2020 15:24:01 +0200 Subject: [PATCH] - Readded 'unused function' (It was used afterall) --- src/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/utils.py b/src/utils.py index 8bf6d56..d3d945b 100644 --- a/src/utils.py +++ b/src/utils.py @@ -70,6 +70,18 @@ def remove_patched_files(original_dir: pathlib.Path, override_dir: pathlib.Path) except BaseException as e: raise e +def extract_date(date_string: str): + """Extract a date in the format of 'd(d) Monthname yyyy'. + Returns a datetime object + """ + date_stripped = re.search(r"\d+ \w* \d+", date_string).group(0) + + locale.setlocale(locale.LC_TIME, "en_US") + date = time.strptime(date_stripped, "%d %B %Y") + locale.setlocale(locale.LC_TIME, "de_DE") + + return date + def check_dotnet(): """Checks if dotnet is available.""" return not (shutil.which("dotnet") is None)