Title: Today-Button wrong month
Last modified: August 31, 2016

---

# Today-Button wrong month

 *  Resolved [garee](https://wordpress.org/support/users/garee/)
 * (@garee)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/today-button-wrong-month/)
 * The Today-Button sets the wrong month: instead of the actual month (february)
   it sets the date to 1 (january). The javascript-method `getMonth()` returns values
   from 0 to 11. So I fixed the problem by adding 1 to the month in `scp_calendar_today()`
   in schedule-posts-calendar.js:
 * `
    var sMon = new String(currentDate.getMonth()+1);
 * [https://wordpress.org/plugins/schedule-posts-calendar/](https://wordpress.org/plugins/schedule-posts-calendar/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/today-button-wrong-month/#post-7022265)
 * It’s a little more complicated than that as we need the zero based index when
   selectedIndex is used later on.
 * Try the following:
 *     ```
       function scp_calendar_today()
       	{
       	var currentDate = new Date();
   
       	SchedulePostsCalendar.setDate(currentDate);
   
       	var sDay = new String(currentDate.getDate());
       	var sMon = new String(currentDate.getMonth());
       	var sMonReal = new String(currentDate.getMonth()+1);
       	var sYear = new String(currentDate.getFullYear());
       	var sHour = new String(currentDate.getHours());
       	var sMin = new String(currentDate.getMinutes());
   
       	var dateString = '';
       	if( sDay.length < 2 ) { sDay = '0' + sDay; }
       	dateString += sDay + '/';
       	if( sMonReal.length < 2 ) { sMonReal = '0' + sMonReal; }
       	dateString += sMonReal + '/' + sYear + ' ';
       	if( sHour.length < 2 ) { sHour = '0' + sHour; }
       	dateString += sHour + ':';
       	if( sMin.length < 2 ) { sMin = '0' + sMin; }
       	dateString += sMin;
   
       	document.getElementById('mm').selectedIndex = sMon;
       	document.getElementById('jj').value = sDay;
       	document.getElementById('aa').value = sYear;
       	document.getElementById('hh').value = sHour;
       	document.getElementById('mn').value = sMin;
   
       	document.getElementById('calendarHere').value = dateString;
       	}
       ```
   
 *  Thread Starter [garee](https://wordpress.org/support/users/garee/)
 * (@garee)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/today-button-wrong-month/#post-7022268)
 * Thanks, that works!
 *  Plugin Author [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/today-button-wrong-month/#post-7022270)
 * What browser are you running?
 *  Thread Starter [garee](https://wordpress.org/support/users/garee/)
 * (@garee)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/today-button-wrong-month/#post-7022309)
 * Chrome and Safari on OSX. I get the wrong month only when the popup-calendar 
   is enabled in settings. With the collapsible version everything is fine.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Today-Button wrong month’ is closed to new replies.

 * ![](https://ps.w.org/schedule-posts-calendar/assets/icon-256x256.png?rev=2957028)
 * [Schedule Posts Calendar](https://wordpress.org/plugins/schedule-posts-calendar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/schedule-posts-calendar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/schedule-posts-calendar/)
 * [Active Topics](https://wordpress.org/support/plugin/schedule-posts-calendar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/schedule-posts-calendar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/schedule-posts-calendar/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [garee](https://wordpress.org/support/users/garee/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/today-button-wrong-month/#post-7022309)
 * Status: resolved