/**
* @description
* extends $.datepicker for fw requirements, include week, month, quarter
* @extends $.datepicekr
* @requires @.datepicker
*/
(function($) {
/**
* @description This block is extend for date selectable range
* @param{Boolean} monthpicker Default value is false, trigger to show monthpicker
* @param{Boolean} quarterpicker Default value is false, trigger to show quarterpicker
* @example
* for monthpicker, set "monthpicker" as true
* for quarterpicker, set "quarterpicker" as true
*/
$.extend(true, $.datepicker, {
monthpicker: false,
quarterpicker: false,
/**
* @public
* @description validate leap year
* @param{String} yyyy
* @returns{Boolean} true / false
*/
validateLeapYear: function(yearText) {
return (yearText % 4 == 0 && yearText % 100 != 0) || (yearText % 400 == 0);
},
/**
* @public
* @description get last day of month
* @param{Object|String} date as a Date object
* @returns{String} mm/dd/yyyy
*/
getMonthLastDay: function(date) {
if(typeof date == 'string') {
date = new Date(date);
}
var year = date.getFullYear(),
month = date.getMonth() + 1,
realDate = date.getDate();
if(month < 10) {
month = '0' + month;
}
return month + '/' + (32 - new Date(year, month - 1, 32).getDate()) + '/' + year;
},
/**
* @public
* @description set date range only Saturday selectable
* @param{Object} date as a Date object
* @returns{[]} [[0] = true if selectable, false if not, [1] = custom CSS class name(s) or '']
*/
onlySaturday: function(date) {
var day = date.getDay();
return [(day == 6), ''];
},
/**
* @public
* @description set date range only Sunday selectable
* @param{Object} date as a Date object
* @returns{[]} [[0] = true if selectable, false if not, [1] = custom CSS class...
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.