To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more

date-picker.js issue with leap year

thedinnerdudetx
New Member
1 0 0

Leap year has goofed returning the proper day/date moving forward after Feb 29. Any help with fix?  see code below.  TIA

 

$(document).ready(function(){
var d = new Date();
var current_day = d.getDay();
var current_date = d.getDate();
var current_month = d.getMonth();
var appendelement = '<div class="date-picker"><ul class="date-picker-dates" style="width: 200%; transform: translateX(0%);">';
var start_date = current_date - current_day;
var end_date = start_date+14;
var current_hour = d.getHours();
var current_minutes = d.getMinutes();


/* Certain days list during the Year
please write Certain days in this array */
// ex : /* May */ [2,4,6],
// /* Jul */ [12,26]

var certain_days = [
/* Jan */ [],
/* Feb */ [27,29],
/* Mar */ [3,6,9,12,14,16,19,21,24,27,29],
/* Apr */ [],
/* May */ [],
/* Jun */ [15,22,29],
/* Jul */ [6,13,20,27],
/* Aug */ [3,10,17,24,31],
/* Sep */ [2,3,4,16],
/* Oct */ [5,7,10,12],
/* Nov */ [2,9,16,23,28,29],
/* Dec */ [7,14,21,25],
];


//if(current_day==0){
//$('nav>ul.site-nav li:nth-child(1) a').attr('href','/pages/weekend');
//}

var weekday = new Array(14);
weekday['Su'] = "Sunday";
weekday['Mo'] = "Monday";
weekday['Tu'] = "Tuesday";
weekday['We'] = "Wednesday";
weekday['Th'] = "Thursday";
weekday['Fr'] = "Friday";
weekday['Sa'] = "Saturday";

var month_name = new Array(14);
month_name['1'] = 'Jan';
month_name['2'] = 'Feb';
month_name['3'] = 'Mar';
month_name['4'] = 'Apr';
month_name['5'] = 'May';
month_name['6'] = 'Jun';
month_name['7'] = 'Jul';
month_name['8'] = 'Aug';
month_name['9'] = 'Sep';
month_name['10'] = 'Oct';
month_name['11'] = 'Nov';
month_name['12'] = 'Dec';
for(i=0;i<12;i++){
if(start_date<1){
if((i+start_date)<1){
if(current_month==4||current_month==6||current_month==9||current_month==11){
var rel_date = i+start_date+30;
var rel_month = current_month;
}
else if(current_month==2){
var rel_date = i+start_date+28;
var rel_month = current_month;
}
else{
var rel_date = i+start_date+31
var rel_month = current_month;

Replies 0 (0)