現在の日付と時刻を、現在の日付と時刻のリストと比較しています。コードの最後で、getDates が出力より大きいかどうかを比較しています。true の場合はループを停止し、一致した値を使用します (停止するには、return false を使用しています)。どうすればいいですか?何かを挿入する必要がある場所だと思っている「MATCHED VALUE GOES HERE」とメモしました。
// Get current date, format it
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var hour = d.getHours();
var minute = d.getMinutes();
var output = d.getFullYear() + '-' +
((''+month).length<2 ? '0' : '') + month + '-' +
((''+day).length<2 ? '0' : '') + day + ' ' +
((''+hour).length<2 ? '0' :'') + hour + ':' +
((''+minute).length<2 ? '0' :'') + minute
alert(output)
// Get all dates and time found in the table on this page
$('td:first-child').each(function() {
var getDates = $(this).text();
// Check if dates in table expired. If expired skip and display upcoming one
// if getDates is bigger than output then stop looping and use it
if ( getDates > output) {
alert('true')
return false;
$('#defaultCountdown').countdown({until: new Date(MATCHED VALUE GOES HERE)});
}