diff options
author | Felix Krause <contact@flyx.org> | 2016-08-19 12:34:10 +0200 |
---|---|---|
committer | Felix Krause <contact@flyx.org> | 2016-08-19 12:34:10 +0200 |
commit | 68680a9880db4187acb616b9f1b98ad4a3965efd (patch) | |
tree | 855bbe8aed51bb745b71d239240ed782daeb2687 | |
parent | 006207742f43f4e793b8681c38b879d74d3f8672 (diff) | |
download | Nim-68680a9880db4187acb616b9f1b98ad4a3965efd.tar.gz |
Calculate correct yearday in times.parse
-rw-r--r-- | lib/pure/times.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index d6eb29e1c..b78a2b966 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -1248,8 +1248,11 @@ proc parse*(value, layout: string): TimeInfo = else: parseToken(info, token, value, j) token = "" - # Reset weekday as it might not have been provided and the default may be wrong - info.weekday = getLocalTime(toTime(info)).weekday + # Reset weekday (might not have been provided and the default may be wrong) + # and yearday (is never provided directly and therefore probably wrong) + let processed = getLocalTime(toTime(info)) + info.weekday = processed.weekday + info.yearday = processed.yearday return info # Leap year calculations are adapted from: |