/////////////////// Functions //////////////////
function monthDiff(d1, d2) {
var months;
months = (d2.getFullYear() - d1.getFullYear()) * 12;
months -= d1.getMonth() + 1;
months += d2.getMonth();
return months <= 0 ? 0 : months;
}
function formatDate(d) {
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var today = d;
today = new Date(today);
var dd = today.getDate();
//var mm = months[today.getMonth()+1];
var mm = months[today.getMonth()];
var yyyy = today.getFullYear();
//if(dd<10){ dd = '0'+dd }
//if(mm<10){ mm = '0'+mm }
return dd + '-' + mm + '-' + yyyy;
}
function todayFDate() {
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var today = new Date();
var dd = today.getDate();
//var mm = months[today.getMonth()+1];
var mm = months[today.getMonth()];
var yyyy = today.getFullYear();
//if(dd<10){ dd = '0'+dd }
//if(mm<10){ mm = '0'+mm }
return dd + '-' + mm + '-' + yyyy;
}
$("#futureDate").datepicker({
yearRange: "-20:+100",
changeMonth: true,
changeYear: true,
dateFormat: "d-MM-yy"
});
function checkDOB(fd) {
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var givenDate = fd;
givenDate = new Date(givenDate);
var d = givenDate.getDate();
var m = months[givenDate.getMonth()];
var y = givenDate.getFullYear();
var currentDate = new Date();
var yplus = currentDate.setDate(currentDate.getDate() + 364);
if (givenDate < yplus) {
results = 'Your Retirement Age should be at least 1 year from today.'
} else {
results = d + '-' + m + '-' + y
}
return results;
}
function pPer(A, r, n, t, pt) {
var x = (r / n);
var y = (n * t);
var z = Math.pow(1 + x, y);
var B = ((z - 1) /...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.