Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

JavaScript How to add Shrove Tuesday and lent to this script

JavaScript:
(function(){

    var linebreak = true, // should line break be added after date and holidays (if any) (true/false)

    calendar = new Date(), day = calendar.getDay(), month = calendar.getMonth(), date = calendar.getDate(), year = calendar.getFullYear(),

    f = Math.floor, cent = f(year / 100), g = year % 19, k = f((cent - 17) / 25), i = (cent - f(cent / 4) - f((cent - k) / 3) + 19 * g + 15) % 30,

    i = i - f(i / 28) * (1 - f(i / 28) * f(29 / (i+1)) * f((21-g) / 11)), j = (year + f(year / 4) + i + 2 - cent + f(cent / 4)) % 7, l = i - j,

    emonth = 3 + f((l + 40) / 44), edate = l + 28 - 31 * f((emonth / 4)), gfwmcal = new Date(), adcal = new Date(), cd = 25, gfmonth, dhtml = [],

    dayname = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], gfdate, wmmonth, wmdate, admonth, addate,

    monthname = ["January","February","March","April","May","June","July","August","September","October","November","December"],

    html = [dayname[day], ", ", monthname[month], " ", date < 10? "0" : "", date, ", ", year], thanksdate = new Date();

    gfwmcal.setMonth(--emonth);

    gfwmcal.setDate(edate - 2);

    gfmonth = gfwmcal.getMonth();

    gfdate = gfwmcal.getDate();

    gfwmcal.setDate(gfdate + 52);

    wmmonth = gfwmcal.getMonth();

    wmdate = gfwmcal.getDate();

    adcal.setMonth(11);

    adcal.setDate(cd);

    if(adcal.getDay()){cd += (7 - adcal.getDay());}

    adcal.setDate(cd - 28);

    admonth = adcal.getMonth();

    addate = adcal.getDate();

    thanksdate.setMonth(10);

    thanksdate.setDate(1);

    thanksdate = 5 - thanksdate.getDay();

    thanksdate += (thanksdate < 1? 28 : 21);

    // Easter and Related

  

    if (month === emonth && date === edate) dhtml.push("Easter Sunday (Western)<p></p>");

    if (month === gfmonth && date === gfdate) dhtml.push("Good Friday (Western)<p></p>");

    if (month === wmmonth && date === wmdate) dhtml.push("Whit Monday<p></p>");
 
Last edited by a moderator:
JavaScript:
(function(){

    var linebreak = true, // should line break be added after date and holidays (if any) (true/false)

    calendar = new Date(), day = calendar.getDay(), month = calendar.getMonth(), date = calendar.getDate(), year = calendar.getFullYear(),

    f = Math.floor, cent = f(year / 100), g = year % 19, k = f((cent - 17) / 25), i = (cent - f(cent / 4) - f((cent - k) / 3) + 19 * g + 15) % 30,

    i = i - f(i / 28) * (1 - f(i / 28) * f(29 / (i+1)) * f((21-g) / 11)), j = (year + f(year / 4) + i + 2 - cent + f(cent / 4)) % 7, l = i - j,

    emonth = 3 + f((l + 40) / 44), edate = l + 28 - 31 * f((emonth / 4)), gfwmcal = new Date(), adcal = new Date(), cd = 25, gfmonth, dhtml = [],

    dayname = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], gfdate, wmmonth, wmdate, admonth, addate,

    monthname = ["January","February","March","April","May","June","July","August","September","October","November","December"],

    html = [dayname[day], ", ", monthname[month], " ", date < 10? "0" : "", date, ", ", year], thanksdate = new Date();

    gfwmcal.setMonth(--emonth);

    gfwmcal.setDate(edate - 2);

    gfmonth = gfwmcal.getMonth();

    gfdate = gfwmcal.getDate();

    gfwmcal.setDate(gfdate + 52);

    wmmonth = gfwmcal.getMonth();

    wmdate = gfwmcal.getDate();

    adcal.setMonth(11);

    adcal.setDate(cd);

    if(adcal.getDay()){cd += (7 - adcal.getDay());}

    adcal.setDate(cd - 28);

    admonth = adcal.getMonth();

    addate = adcal.getDate();

    thanksdate.setMonth(10);

    thanksdate.setDate(1);

    thanksdate = 5 - thanksdate.getDay();

    thanksdate += (thanksdate < 1? 28 : 21);

    // Easter and Related

 

    if (month === emonth && date === edate) dhtml.push("Easter Sunday (Western)<p></p>");

    if (month === gfmonth && date === gfdate) dhtml.push("Good Friday (Western)<p></p>");

    if (month === wmmonth && date === wmdate) dhtml.push("Whit Monday<p></p>");
Sorry, but I'm an atheist
 

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom