Add month check back in.

parent 65f7dcd0
Pipeline #92 canceled with stage
......@@ -6,7 +6,8 @@ jQuery( document ).ready( function ( $ ) {
// Set up some values;
let todays_date = new Date();
let this_day = todays_date.getDate();
let cookie_life = 30;
let this_month = todays_date.getMonth();
let cookie_life = 45;
// Check for debug mode and a pretend date
if ( advent_calendar_data.debug_mode ) {
......@@ -17,6 +18,7 @@ jQuery( document ).ready( function ( $ ) {
if ( advent_calendar_data.debug_date ) {
this_day = advent_calendar_data.debug_date;
this_day = parseInt( this_day );
this_month = 11; // January is 0
console.log( 'Pretend day of month ', this_day );
}
}
......@@ -32,7 +34,7 @@ jQuery( document ).ready( function ( $ ) {
let day_num = day_name.replace( 'day-', '' );
// don't open the door is it's too early.
if ( day_num > this_day ) {
if ( (this_month < 11 ) || (day_num > this_day) ) {
if ( advent_calendar_data.debug_mode ) {
console.log( 'Cant open day ', day_num, ' Too early' );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment