diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-08-25 16:36:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-25 16:36:49 +0200 |
commit | feec7f9334dbec31eeb6e14ffb1eb663dd722c91 (patch) | |
tree | e9ea5535929a07543ae0a5bd20c59b8df5656804 /lib/pure | |
parent | 56c31a51d0fe15b3e039701b99fbe869fe933d11 (diff) | |
parent | 932abc7bf85916d463321f06395eef7660fe4f7f (diff) | |
download | Nim-feec7f9334dbec31eeb6e14ffb1eb663dd722c91.tar.gz |
Merge pull request #4629 from flyx/times-parse-yearday
Calculate correct yearday in times.parse
Diffstat (limited to 'lib/pure')
-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: |