Accept dates in ISO format only

This commit is contained in:
Michał Leśniewski
2021-11-24 22:08:16 +01:00
parent 1576953d15
commit 16807c93e8
2 changed files with 2 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ optional arguments:
Example
```
$ elicznik freddy@example.com secretpassword 10.7.2021
$ elicznik freddy@example.com secretpassword 2021-07-10
timestamp consumed produced
------------------- ---------- ----------
2021-07-03 01:00:00 0.116 0

View File

@@ -22,7 +22,7 @@ def main():
parser.add_argument(
"date",
nargs="?",
type=lambda arg: datetime.datetime.strptime(arg, "%d.%m.%Y").date(),
type=datetime.date.fromisoformat,
default=datetime.date.today() - datetime.timedelta(days=1),
help="Date of data to be retrieved",
)