From 875e344be0f0202885f0d5ed7f10188835a171d0 Mon Sep 17 00:00:00 2001 From: Konstantin Molchanov Date: Wed, 29 Mar 2017 14:36:04 +0400 Subject: [PATCH] JS: Add yearday calculation to getLocalTime and getGMTime, so that yearday is not 0 for TimeInfo instances under JS backend. (#5616) --- lib/pure/times.nim | 10 ++++++++-- tests/js/ttimes.nim | 13 +++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/js/ttimes.nim diff --git a/lib/pure/times.nim b/lib/pure/times.nim index fe35c404c..2b7c22145 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..