jdadwilson Posted July 21, 2007 Share Posted July 21, 2007 First let me say I am a complete newbie to javascript. I found the following script recently. Its purpose is to identify if a date is a holiday. Looks very good. Problem is this I have no clue as to the required format of the input variable. Any help is greatly appreciated. TIA... here is a snippet of the function. function check_holiday (dt_date) { // check simple dates (month/date - no leading zeroes) var n_date = dt_date.getDate(), n_month = dt_date.getMonth() + 1; var s_date1 = n_month + '/' + n_date; if ( s_date1 == '1/1' // New Year's Day || s_date1 == '6/14' // Flag Day || s_date1 == '7/4' // Independence Day || s_date1 == '11/11' // Veterans Day || s_date1 == '12/25' // Christmas Day ) return true; return false; } Link to comment https://forums.phpfreaks.com/topic/61154-solved-help-needed-with-javascript/ Share on other sites More sharing options...
Karl33to Posted July 24, 2007 Share Posted July 24, 2007 looks like its being passed a date object, consider the following... // checks to see if todays date is a holiday var dt_date= new Date(); if(check_holiday (dt_date)) { alert("date OK"); } // check another date var dt_date= new Date("October 12, 1988"); if(check_holiday (dt_date)) { alert("date OK"); } Link to comment https://forums.phpfreaks.com/topic/61154-solved-help-needed-with-javascript/#findComment-306732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.