Merge pull request #4629 from flyx/times-parse-yearday
Calculate correct yearday in times.parse
This commit is contained in:
commit
feec7f9334
2 changed files with 37 additions and 40 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue