File "picker03.html"

Full Path: /home/analogde/www/Design/fileman/Fusion/datepicker/picker03.html
File size: 6.18 KB
MIME-type: text/html
Charset: utf-8

<!--
https://dzone.com/articles/disable-dates-in-datepicker

https://www.simonbattersby.com/blog/jquery-ui-datepicker-disabling-specific-dates/


https://stackoverflow.com/questions/19395558/highlight-disable-specific-days-in-jquery-ui-datepicker

https://davidwalsh.name/jquery-datepicker-disable-days

https://grafxflow.co.uk/blog/php-and-html-and-css/jquery-datepicker-disable-dates

https://codepen.io/jvloo/pen/bGVbJGb

https://www.devcurry.com/2010/07/disable-certain-days-in-week-using.html

disable holiday

https://jsfiddle.net/Virtual/gvz3P/

https://websolutionstuff.com/post/how-to-disable-specific-dates-in-jquery-datepicker

https://stackoverflow.com/questions/62437409/jquery-ui-datepicker-exclude-weekends-and-holidays


https://codes-sources.commentcamarche.net/source/16385-calcul-du-nombre-de-jours-ouvrables

https://www.sourcecodester.com/tutorial/javascript/16270/how-get-actual-easter-date-javascript#google_vignette

-->

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
  <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
  <script>
  
var bankHoliDays = ["03-25-2024", "03-26-2024"];
function disableDates(date) 
{
    var dt = $.datepicker.formatDate('mm-dd-yy', date);
    var noWeekend = jQuery.datepicker.noWeekends(date);
    return noWeekend[0] ? (($.inArray(dt, bankHoliDays) < 0) ? [true] : [false]) : noWeekend;
}
  
  $( function() {
    $( "#datepicker" ).datepicker( {
  beforeShowDay: disableDates
} );
  } );
  
  
  //console.log(JoursFeries (2024));
  
  /*function JoursFeries (an){
	
	var JourAn = new Date(an, "01", "01")
	var FeteTravail = new Date(an, "05", "01")
	var Victoire1945 = new Date(an, "05", "08")
	var FeteNationale = new Date(an,"07", "14")
	var Assomption = new Date(an, "08", "15")
	var Toussaint = new Date(an, "11", "01")
	var Armistice = new Date(an, "11", "11")
	var Noel = new Date(an, "12", "25")
	
	/*
	var Jour_an = "01-01";
	var Lundi_paques
	var Fete_du_travail = "01-05"
	var Victoire_allies = "08-05";
	var Jeudi_ascension
	var Lundi_pentecote 
	var Fete_nationale = "14-07";
	var Assomption = "15-08";
	var Toussaint = "01-11"
	var Armistice = "11-11";
	var noel = "25-12";*/
/*	
	var G = an%19
	var C = Math.floor(an/100)
	var H = (C - Math.floor(C/4) - Math.floor((8*C+13)/25) + 19*G + 15)%30
	var I = H - Math.floor(H/28)*(1 - Math.floor(H/28)*Math.floor(29/(H + 1))*Math.floor((21 - G)/11))
	var J = (an*1 + Math.floor(an/4) + I + 2 - C + Math.floor(C/4))%7
	var L = I - J
	var MoisPaques = 3 + Math.floor((L + 40)/44)
	var JourPaques = L + 28 - 31*Math.floor(MoisPaques/4)
	var Paques = new Date(an, MoisPaques-1, JourPaques)
	var VendrediSaint = new Date(an, MoisPaques-1, JourPaques-2)
	
	var LundiPaques = new Date(an, MoisPaques-1, JourPaques+1)
	var Ascension = new Date(an, MoisPaques-1, JourPaques+39)
	var Pentecote = new Date(an, MoisPaques-1, JourPaques+49)
	var LundiPentecote = new Date(an, MoisPaques-1, JourPaques+50)
	
	return new Array(JourAn, VendrediSaint, Paques, LundiPaques, FeteTravail, Victoire1945, Ascension, Pentecote, LundiPentecote, FeteNationale, Assomption, Toussaint, Armistice, Noel )
}*/


let m=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
 
 displayDate();
 
function displayDate(){
	let year= "2024"; //document.getElementById('year').value;
 
	if(year.length == 0){
		alert("Please enter something");
	}else{
		let month=getEasterDate(year)[0];
		let day=getEasterDate(year)[1];
		document.getElementById('result').innerHTML="<h3>The easter date is: </h3><center><h2 class='text-primary'>"+m[month-1]+" "+day+", "+year+"</h2></center>";
	}
}
 
function getEasterDate(year) {
	let f = Math.floor;
	let G = year % 19;
	let	C = f(year / 100);
	let H = (C - f(C / 4) - f((8 * C + 13)/25) + 19 * G + 15) % 30;
	let I = H - f(H/28) * (1 - f(29/(H + 1)) * f((21-G)/11));
	let J = (year + f(year / 4) + I + 2 - C + f(C / 4)) % 7;
	let L = I - J;
	let month = 3 + f((L + 40)/44);
	let day = L + 28 - 31 * f(month / 4);
 
	return [month,day];
}

  
 /* 
  var disabledDays = ["2-21-2010","2-24-2010","2-27-2010","2-28-2010","3-3-2010","3-17-2010","4-2-2010","4-3-2010","4-4-2010","4-5-2010"];

/* utility functions */
/*function nationalDays(date) {
	var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
	//console.log('Checking (raw): ' + m + '-' + d + '-' + y);
	for (i = 0; i < disabledDays.length; i++) {
		if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1 || new Date() > date) {
			//console.log('bad:  ' + (m+1) + '-' + d + '-' + y + ' / ' + disabledDays[i]);
			return [false];
		}
	}
	//console.log('good:  ' + (m+1) + '-' + d + '-' + y);
	return [true];
}

function noWeekendsOrHolidays(date) {
	var noWeekend = jQuery.datepicker.noWeekends(date);
	return noWeekend[0] ? nationalDays(date) : noWeekend;
}

/* create datepicker */
/*jQuery(document).ready(function() {
	jQuery('#date').datepicker({
		minDate: new Date(2010, 0, 1),
		maxDate: new Date(2010, 5, 31),
		dateFormat: 'DD, MM, d, yy',
		constrainInput: true,
		beforeShowDay: noWeekendsOrHolidays
	});
});
  */
  /*
  var dateToday = new Date();

$('#visit').datepicker({
    beforeShowDay: checkAvailable,
    minDate: dateToday
});

var unavailableDates = ["19-10-2024"];

function checkAvailable(date) {
    dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
    if ($.inArray(dmy, unavailableDates) != -1) {

        return [false, "", "unAvailable"];
    } else {
        var day = date.getDay();
        return [(day != 0 && day != 6)];
    }
}
  */
  </script>
</head>
<body>
 
<p>Date: <input type="text" id="datepicker"></p>

<div id="result">dsfsdfsdfqfd</div>
 
<!-- 
 <input type='text' id='visit' />
 -->
 
</body>
</html>