From e0ba76e2fe107105c8889d20d87d44c2265ab0fd Mon Sep 17 00:00:00 2001 From: dyod Date: Wed, 24 Jan 2018 10:06:08 +0600 Subject: [PATCH] Set current month as default period While retrieving events for events list required to specify month or day of month. While initializing current month of current year should be specified. Fixes issue #43. --- js/jquery.eventCalendar.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/jquery.eventCalendar.js b/js/jquery.eventCalendar.js index aedd90b..cac4113 100644 --- a/js/jquery.eventCalendar.js +++ b/js/jquery.eventCalendar.js @@ -271,7 +271,10 @@ function getEvents(flags, eventsOpts, limit, year, month, day, direction) { limit = limit || 0; - year = year || ''; + + var today = new Date(); + + year = year || today.getFullYear(); day = day || ''; // to avoid problem with january (month = 0) @@ -281,6 +284,9 @@ } else { month = ''; } + if (!month) { + month = today.getMonth(); + } //var month = month || ''; flags.wrap.find('.eventCalendar-loading').fadeIn();