From bef86f55ceefb1f2ea3fb95a1a5112530707bd46 Mon Sep 17 00:00:00 2001 From: Konstantin Molchanov Date: Mon, 27 Mar 2017 00:14:48 +0400 Subject: [PATCH] Times: JS: Add yearday to TimeInfo. Add yearday calculation to getLocalTime and getGMTime, so that yearday is not 0 for TimeInfo instances under JS backend. Yearday 0 has no sense and contradicts the behaviour under C backend, where yearday is an int from 1 to 365, i.e. cannot be 0 even theoretically. --- lib/pure/times.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pure/times.nim b/lib/pure/times.nim index fe35c404c6..2b7c221452 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -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..