cg()

by toubia95

CSS

/* http://stackoverflow.com/questions/1056728/where-can-i-find-documentation-on-formatting-a-date-in-javascript */

JavaScript

var gnjs=function(){"use strict";var e={m:[" janvier "," février "," mars "," avril "," mai "," juin "," juillet "," août "," septembre "," octobre "," novembre "," décembre "]},t=function(e,t,n){return new Date(n,t-1,e)},n=function(t,n){return t instanceof Date?void 0===n?t.getDate()+e.m[t.getMonth()]+(t.getYear()+1900):t.getDate()+n+(t.getMonth()+1)+n+(t.getYear()+1900):void 0},a=function(e,t){return e instanceof Date&&isFinite(parseInt(t,10))?{s:new Date(e.getYear()+1899-t,e.getMonth(),e.getDate()+1),e:new Date(e.getYear()+1901-t,e.getMonth(),e.getDate()-1),y:parseInt(e.getYear()+1900-t,10)}:void 0},r=function(e,t){return e instanceof Date&&t instanceof Date?{s:e>t?t:e,e:e>t?e:t,l:Math.round(Math.abs((t-e)/864e5)+1)}:void 0},i=function(e,t){var n,a,r;return e&&t&&e.s instanceof Date&&e.e instanceof Date&&t.s instanceof Date&&t.e instanceof Date&&(e.e<t.s||e.s>t.e?n={}:(a=new Date(Math.max(e.s,t.s)),r=new Date(Math.min(e.e,t.e)),n=this.p(a,r))),n};return{c:e,d:t,df:n,a:a,p:r,po:i}}(); 

var joursem = ["lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche"];
var joursemabbr = ["lun.","mar.","mer.","jeu.","ven.","sam.","dim."];
var mois = ["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"];
var moisabbr = ["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."];
var cg = gnjs.d(08,07,1972);
console.log("cg = "+cg);
var Y = cg.getFullYear(); //Année YYYY
console.log("Y = "+Y);
var y = parseInt(Y.toString().substr((Y.toString().length)-2,2));
console.log("y = "+y);
//cg().y (Y.substr(Y.length – 2);)
var n = cg.getMonth()+1; // Mois n
console.log("n = "+n);
var m = (n<10)?"0"+n:n;
console.log("m = "+m);
var F = mois[n-1];
console.log("F = "+F);
var M = moisabbr[n-1];
console.log("M = "+M);
var J = cg.getDate(); // Jour mois J
console.log("J = "+J);
var d = (J<10)?"0"+J:J; //cg().d ((J<10) ? '0'+J:J ;)
console.log("d = "+d);
//var S = (J==1) ?...