Dates - Fêtes mobiles v.1.2

pâques et autres

by toubia95

HTML

Saisie : <input id="year" placeholder="Année"><div id="paques"></div>

CSS

/* Voir http://pgj.pagesperso-orange.fr/paques.htm */
/* A debugger */

JavaScript

$( "#year" ).on( "keyup", function() {
    var annee,cetteannee;
    annee = parseInt($("#year").val(),10);
    cetteannee = new Date().getFullYear();
    if (!annee) annee = cetteannee;
    $( "#paques" ).html(SimplePaques(annee));
});

function SimplePaques(y) {
    var c,n,k,b,e,f,h,p,q,r,i,s,t,u,j,w,m,x,d,affichage,resultat;
    c = parseInt(y / 100, 10);
    n = parseInt(y % 19, 10);
    k = parseInt((c - 17) / 25, 10);
    b = parseInt(c / 4, 10);
    e = parseInt((c - k) / 3, 10);
    f = parseInt(c - b - e + (19 * n) + 15, 10);
    h = parseInt(f % 30, 10);
    p = parseInt(h / 28, 10);
    q = parseInt(29 / (h + 1), 10);
    r = parseInt((21 - n) / 11, 10);
    i = parseInt(h - (p * (1 - (p * q * r))), 10);
    s = parseInt(y / 4, 10);
    t = parseInt(c / 4, 10);
    u = parseInt(y + s + i + 2 - c + t, 10);
    j = parseInt(u % 7, 10);
    w = parseInt((i - j + 40) / 44, 10);
    m = parseInt(3 + w, 10); // mois
    x = parseInt(m / 4, 10);
    d = parseInt(i - j + 28 - (31 * x), 10); // jour
    affichage = "<p>Mardi-gras : " + DateDisplay(y, m, d - 47) + "<br>Mercredi des Cendres : " + DateDisplay(y, m, d - 46) + "<br>Rameaux : " + DateDisplay(y, m, d - 7) + "<br>Pâques chrétiennes : " + DateDisplay(y, m, d) + "<br>Ascension : " + DateDisplay(y, m, d + 39) + "<br>Pentecôte : " + DateDisplay(y, m, d + 49) + "<br>Trinité : " + DateDisplay(y, m, d + 56) + "<br>Fête-Dieu : " + DateDisplay(y, m, d + 60) + "<br>Pâques orthodoxes :<br>Pâques juives :<br></p>"; /*"Paques = "+d+" "+Mois[m-1];*/
    resultat = (y > 1582) ? affichage : "<br>Date invalide";
    return resultat;
}

function DateDisplay(theannee, themois, thejour) {
    var thedate,Mois,Semaine,js,jd,mo,an;
    thedate = new Date(theannee, themois - 1, thejour);
    Mois = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
    Semaine = ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"];
    js =...