Mercurial > libervia-backend
comparison frontends/src/jp/cmd_event.py @ 2247:0f3bfe89999e
jp (event): don't use dayfirst for YY-MM-DD style dates
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 21 May 2017 15:47:53 +0200 |
parents | 9d49e66bdbf2 |
children | 5b04fc0c663d |
comparison
equal
deleted
inserted
replaced
2246:e8641b7718dc | 2247:0f3bfe89999e |
---|---|
79 if self.args.date: | 79 if self.args.date: |
80 try: | 80 try: |
81 date = int(self.args.date) | 81 date = int(self.args.date) |
82 except ValueError: | 82 except ValueError: |
83 try: | 83 try: |
84 date_time = du_parser.parse(self.args.date, dayfirst=True) | 84 date_time = du_parser.parse(self.args.date, dayfirst=not (u'-' in self.args.date)) |
85 except ValueError as e: | 85 except ValueError as e: |
86 self.parser.error(_(u"Can't parse date: {msg}").format(msg=e)) | 86 self.parser.error(_(u"Can't parse date: {msg}").format(msg=e)) |
87 if date_time.tzinfo is None: | 87 if date_time.tzinfo is None: |
88 date = calendar.timegm(date_time.timetuple()) | 88 date = calendar.timegm(date_time.timetuple()) |
89 else: | 89 else: |