GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — parse() rejects ISO 8601 week dates with years < 1000 (strptime %Y needs zero-padding) · Issue #1076 · python-pendulum/pendulum DescriptionSummary
>>> import pendulum >>> pendulum.parse("2016-W34-6") 2016-08-27 00:00:00+00:00 >>> pendulum.parse("1000-W34-6") 1000-08-23 00:00:00+00:00 >>> pendulum.parse("0999-W34-6") pendulum.parsing.exceptions.ParserError: Unable to parse string [0999-W34-6] >>> pendulum.parse("0416-08-21") # same year, calendar form: fine 0416-08-21 00:00:00+00:00 >>> pendulum.parse("0416-W34-6") ParserError: Unable to parse string [0416-W34-6] >>> pendulum.parse("0416W346") # basic format: also broken ParserError: Unable to parse string [0416W346] All of Root cause
fmt = "%Y-%j" string = f"{year}-{ordinal}" dt = datetime.datetime.strptime(string, fmt) The year is interpolated without zero-padding, so for year 416 the string is The boundary is exact: years ≥ 1000 work, years ≤ 999 fail. Expected behaviorZero-pad the year ( Environment
ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |