diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-06-20 19:58:50 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-06-20 19:58:50 +0200 |
commit | 128d9429fab830dad69243cbf9e6b6af5c3ed258 (patch) | |
tree | d8d54fe42df3e7ac47b109e17176a3e7424c8fb3 | |
parent | 8d05bbe33656d9d46f5b7de18f441f85a02f29b3 (diff) |
Let the parsing of dates happen earlier to give better error messages
-rwxr-xr-x | debdate | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -160,7 +160,8 @@ class Command: self.date_options.add_argument( '-d', '--date', help='A gregorian date', - default='', + default=None, + type=parser.parse, ) self.date_options.add_argument( '-s', '--seconds', @@ -182,7 +183,7 @@ class Command: def print_date(self, args): if args.date: - date = parser.parse(args.date).date() + date = args.date.date() elif args.seconds: date = datetime.date.fromtimestamp(args.seconds) else: |