Merge branch 'calculate_yearday_in_timeinfo_js' into fix_time_offset_in_times_js

This commit is contained in:
Konstantin Molchanov 2017-03-27 21:38:19 +04:00
commit 2351d5d314
2 changed files with 21 additions and 2 deletions

View file

@ -597,9 +597,12 @@ elif defined(JS):
result.month = Month(t.getMonth())
result.year = t.getFullYear()
result.weekday = weekDays[t.getDay()]
result.yearday = 0
result.timezone = getTimezone()
result.yearday = result.monthday - 1
for month in mJan..<result.month:
result.yearday += getDaysInMonth(month, result.year)
proc getGMTime(t: Time): TimeInfo =
result.second = t.getUTCSeconds()
result.minute = t.getUTCMinutes()
@ -608,7 +611,10 @@ elif defined(JS):
result.month = Month(t.getUTCMonth())
result.year = t.getUTCFullYear()
result.weekday = weekDays[t.getUTCDay()]
result.yearday = 0
result.yearday = result.monthday - 1
for month in mJan..<result.month:
result.yearday += getDaysInMonth(month, result.year)
proc timeInfoToTime(timeInfo: TimeInfo): Time = toTime(timeInfo)